728x90
반응형

[Review] (1주차) 실습

2022.06.19 - [Swift] - [Xcode] iOS Swift 앱 개발 Byte Degree - week.01

 

[Xcode] iOS Swift 앱 개발 Byte Degree - week.01

[강의노트] 왕초보를 위한, 한 번에 끝내는 iOS 앱 개발 바이블 https://opposite-foundation-5b5.notion.site/iOS-4b1c2a2c1baf4ae29971524e9bdfc074 [Github] https://github.com/cafielo/fc-ios-bible-for-begi..

sarahee.tistory.com


iOS 아키텍처 패턴 중 애플에서는 기본적으로 MVC 패턴을 가이드함

SF Symbols download

Product Name: HelloiOS

Organization Identifier: com.sehee

Interface: Storyboard (other options: SwiftUI)

Language:  Swift (other options: Objective-C)

command + shift + C

글자 복사

기존 프레임 기반 레이아웃 → 오토레이아웃: 동적으로 뷰 위치

//
//  SymbolRollerViewController.swift
//  SymbolRoller
//
//  Created by sehee on 2022/06/26.
//

import UIKit

class SymbolRollerViewController: UIViewController {

    let symbols: [String] = ["sun.min", "moon", "cloud", "wind", "snowflake"]
    
    @IBOutlet weak var imageView: UIImageView!
    @IBOutlet weak var label: UILabel!
    @IBOutlet weak var button: UIButton!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
//        button.tintColor = UIColor.systemPink
        // TO-DO:
        // - 심볼에서, 하나를 임의로 추출해서
        // 이미지와 텍스트를 설정
        // DRY: Do not repeat yourself
        reload()
        // Do any additional setup after loading the view.
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
    }
    
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
    }
    func reload() {
        let symbol = symbols.randomElement()!
        imageView.image = UIImage(systemName: symbol)
        label.text = symbol
    }
    
    @IBAction func buttonTapped(_ sender: Any) {
        reload()
    }
    
    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}

ViewController: 페이지를 나타내기 위한 객체

option + shift + 8

° 기호

option + command + =

설정값 변경 전(주황색 표시) 업데이트

//
//  WeatherViewController.swift
//  SimpleWeather
//
//  Created by sehee on 2022/06/26.
//

import UIKit

class WeatherViewController: UIViewController {

    @IBOutlet weak var cityLabel: UILabel!
    @IBOutlet weak var weatherImageView: UIImageView!
    @IBOutlet weak var temperatureLabel: UILabel!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
    }
    
    let cities = ["Seoul", "Tokyo", "LA", "Seattle"]
    let weathers = ["cloud.fill", "sun.max.fill", "wind", "cloud.sun.rain.fill"]
    
    @IBAction func changeeButtonTapped(_ sender: Any) {
        print("도시, 온도, 날씨 이미지 변경하자!")
        cityLabel.text = cities.randomElement()
        let imageName = weathers.randomElement()!
        weatherImageView.image = UIImage(systemName: imageName)?.withRenderingMode(.alwaysOriginal)
        // alwaysTemplate의 경우 default Tint color 적용
        let randomTemp = Int.random(in: 10..<30)
        temperatureLabel.text = "\(randomTemp)°"
    }
    
    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}

 


[Next] (3주차) 실습

2022.07.01 - [Swift] - [Xcode] iOS Swift 앱 개발 Byte Degree - week.03

 

[Xcode] iOS Swift 앱 개발 Byte Degree - week.03

[Review] (2주차) 실습 2022.06.26 - [Swift] - [Xcode] iOS Swift 앱 개발 Byte Degree - week.02 [Xcode] iOS Swift 앱 개발 Byte Degree - week.02 iOS 아키텍처 패턴 중 애플에서는 기본적으로 MVC 패턴을 가..

sarahee.tistory.com

 

 

728x90
728x90

+ Recent posts