TIL50 ✨

YaR Lab·2023년 6월 30일
0

TIL✨

목록 보기
38/135
post-thumbnail

🗓️23.06.30

새로운 파일 생성(xcode)

커맨드+N

제네릭

들어갈 변수타입으로 타입추론이 가능

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        do {
            let expoInformation: ExpoInformation = try jsonDecode(with: "exposition_universelle_1900")
            expoInformationLabel.text = expoInformation.expoDescription
        } catch {
            print("error")
        }
    }

    func jsonDecode<Element: Decodable>(with fileName: String) throws -> Element {
        let jsonDecoder: JSONDecoder = JSONDecoder()

        guard let dataAssert: NSDataAsset = NSDataAsset(name: fileName) else {
            throw ExpoError.decodeError
        }

        return try jsonDecoder.decode(Element.self, from: dataAssert.data)
    }

UIImage(named:)

UIImage(named:) 메서드를 사용하여 이미지를 로드합니다. 이 메서드는 자동으로 기기의 해상도에 맞는 이미지를 선택하여 반환합니다. 예를 들어, 2x 디스플레이에서 실행 중인 경우 2x 이미지를, 3x 디스플레이에서 실행 중인 경우 3x 이미지를 선택합니다.

keydecodingstrategy

https://developer.apple.com/documentation/foundation/jsondecoder/keydecodingstrategy

https://dev.classmethod.jp/articles/xcode_13_ios_15_navigation_bar_color/

indexPathForSelectedRow

트리의 지름

임의의 노드에서 제일 긴 노드를 찾으면 트리의 지름의 한 노드이다

translatesAutoresizeingMaskInto Constraints

스토리보드에서 추가시 false

제약 최소 기준

https://stackoverflow.com/questions/36924093/what-are-the-default-auto-layout-content-hugging-and-content-compression-resista

0개의 댓글