Material complementar utilizado no evento NLW Mobile, para a tecnologia Swift.

Guias

Configuração de ambiente - Swift

Repositório

<aside> <img src="/icons/git_purple.svg" alt="/icons/git_purple.svg" width="40px" />

Commit da aula 01

</aside>

<aside> <img src="/icons/git_purple.svg" alt="/icons/git_purple.svg" width="40px" />

Commit da aula 02

</aside>

<aside> <img src="/icons/git_purple.svg" alt="/icons/git_purple.svg" width="40px" />

Commit da aula 03

</aside>

Downloads

Template-NLW-18-POCKET-MOBILE-SWIFT.zip

Assets.zip

API (Backend)

Para consumir a API, basta fazer o download abaixo, extrair, instalar as dependências com npm i e executar a aplicação com npm run start.

api.zip

<aside> ⚠️

Para a API funcionar, é preciso ter o Node instalado na sua máquina. Caso não tenha, siga essa documentação: Instalando o Node e o NPM

</aside>

Código

Abaixo disponibilizamos alguns códigos para vocês copiarem em vez de escreverem tudo manualmente 💜

Aula 1 - Cores

//
//  Colors.swift
//  NearbyApp NLW
//
//  Created by Arthur Rios on 04/11/24.
//
import Foundation
import UIKit
public struct Colors {
    // Green Shades
    static let greenLight = UIColor(red: 59/255, green: 155/255, blue: 98/255, alpha: 1)   // #3B9B62
    static let greenBase = UIColor(red: 37/255, green: 127/255, blue: 73/255, alpha: 1)    // #257F49
    static let greenDark = UIColor(red: 5/255, green: 41/255, blue: 20/255, alpha: 1)      // #052914
    
    // Red Shades
    static let redLight = UIColor(red: 253/255, green: 237/255, blue: 237/255, alpha: 1)   // #FDEDED
    static let redBase = UIColor(red: 249/255, green: 65/255, blue: 68/255, alpha: 1)      // #F94144
    // Gray Shades (originals)
    static let gray100 = UIColor(red: 252/255, green: 253/255, blue: 254/255, alpha: 1)    // #FCFDFE
    static let gray200 = UIColor(red: 225/255, green: 235/255, blue: 244/255, alpha: 1)    // #E1EBF4
    static let gray300 = UIColor(red: 196/255, green: 208/255, blue: 219/255, alpha: 1)    // #C4D0DB
    static let gray400 = UIColor(red: 115/255, green: 128/255, blue: 140/255, alpha: 1)    // #73808C
    static let gray500 = UIColor(red: 69/255, green: 82/255, blue: 95/255, alpha: 1)       // #45525F
    static let gray600 = UIColor(red: 26/255, green: 31/255, blue: 36/255, alpha: 1)       // #1A1F24
}

Aula 2 - Tipografia

//
//  Typography.swift
//  NearbyApp NLW
//
//  Created by Arthur Rios on 07/11/24.
//

import Foundation
import UIKit

public struct Typography {
    // Title Fonts
    static let titleXL = UIFont(name: "Rubik-Bold", size: 24) ?? UIFont.systemFont(ofSize: 24, weight: .bold)
    static let titleLG = UIFont(name: "Rubik-Bold", size: 20) ?? UIFont.systemFont(ofSize: 20, weight: .bold)
    static let titleMD = UIFont(name: "Rubik-SemiBold", size: 16) ?? UIFont.systemFont(ofSize: 16, weight: .semibold)
    static let titleSM = UIFont(name: "Rubik-SemiBold", size: 14) ?? UIFont.systemFont(ofSize: 14, weight: .semibold)
    
    // Subtitle Fonts
    static let subtitle = UIFont(name: "Rubik-Medium", size: 14) ?? UIFont.systemFont(ofSize: 14, weight: .medium)
    
    // Action Fonts
    static let action = UIFont(name: "Rubik-SemiBold", size: 16) ?? UIFont.systemFont(ofSize: 16, weight: .semibold)
    
    // Text Fonts
    static let textMD = UIFont(name: "Rubik-Regular", size: 16) ?? UIFont.systemFont(ofSize: 16, weight: .regular)
    static let textSM = UIFont(name: "Rubik-Regular", size: 14) ?? UIFont.systemFont(ofSize: 14, weight: .regular)
    static let textXS = UIFont(name: "Rubik-Regular", size: 12) ?? UIFont.systemFont(ofSize: 12, weight: .regular)
}

Aula 3 - HomeView