Swift) ์ฐ์ฐ์ == ์ === ์ ์ฐจ์ด == ์ฐ์ฐ์ a == b: a์ ๊ฐ๊ณผ b์ ๊ฐ์ด ๊ฐ์์ง ๊ฐ์ ๋น๊ต let value1 = 1 let value2 = 2 print(value1 == value2) // false === ์ฐ์ฐ์ a === b: a๊ฐ ์ฐธ์กฐํ๊ณ ์๋ ์ธ์คํด์ค์ b๊ฐ ์ฐธ์กฐํ๊ณ ์๋ ์ธ์คํด์ค๊ฐ ๊ฐ์์ง ๋ ํผ๋ฐ์ค๋ฅผ ๋น๊ต let p1 = Person(id: 1, name: "kim") let p2 = Person(id: 1, name: "kim") let p3 = p1 print(p1 === p2) // false print(p1 === p3) // true `==`๋ stack ์์ญ์ ๊ฐ์ ๋น๊ต, `===`๋ heap ์์ญ์ ๊ฐ์ ๋น๊ต ์ฐธ๊ณ ์๋ฃ https://developer.apple.com/documentation/swift/=.. 2022. 9. 24. Property Wrapper Property Wrapper A property wrapper adds a layer of separation between code that manages how a property is stored and the code that defines a property. For example, if you have properties that provide thread-safety checks or store their underlying data in a database, you have to write that code on every property. When you use a property wrapper, you write the management code once when you define.. 2022. 4. 28. self vs Self ์๋ฌธ์ self ์ธ์คํด์ค ์์ฒด ์ ๊ทผ ์ ์ฌ์ฉ๋๋ ์ฐธ์กฐ๊ฐ self๋ ์ฐธ์กฐ ํ์ value type์์์ self๋ stack์์ญ์ ์กด์ฌํ๋ instance๋ฅผ ๊ฐ๋ฆฌํค๋ ํํ reference type์์์ self๋ heap ์์ญ์ ์กด์ฌํ๋ instance๋ฅผ ๊ฐ๋ฆฌํค๋ ํํ ๋๋ฌธ์ Self Self๋ type๊ทธ ์์ฒด๋ฅผ ์๋ฏธ -> ํ์ ์ ์ ์ํ ๋ ์ฌ์ฉ Self.self๋ type object๋ฅผ ์๋ฏธ -> ํ์ ์ ๋๊ธธ๋ ์ฌ์ฉ protocol ๋ด๋ถ์์์ Self ์๋ฏธ: protocol ์์ ์ด ์๋, ์๊ธฐ ์์ ์ ์ฑํํ ํ์ ์ ์๋ฏธ Class์์์ Self ์๋ฏธ : ํด๋น ์ธ์คํด์ค์ ํ์ ์์ฒด๋ฅผ ํํ ์ฐธ๊ณ ์๋ฃ https://ios-development.tistory.com/600 2022. 4. 27. RxSwift Operator : Map, FlatMap Map transform the items emitted by an Observable by applying a function to each item map์ ์ด๋ฒคํธ๋ฅผ ๋ฐ๊พผ๋ค. E Type์ด๋ฒคํธ๋ฅผ R Type์ด๋ฒคํธ๋ก ๋ฐ๊พผ๋ค map์ ํด๋ก์ ์ ์ฐ์ฐ ๊ฐ์ ๋ฆฌํด์ํจ๋ค observable๋ก ๋ถํฐ emit๋๋ item์ ๋ค๋ฅธ ํ์ ์ผ๋ก ๋ฐ๊พธ๊ณ ์ถ์๋ map์ด ์ฌ์ฉ๋๋ค FlatMap transform the items emitted by an Observable into Observables, then flatten the emissions from those into a single Observable ์ด๋ฒคํธ๋น ํ ๊ฐ์ ์๋ก์ด Observable ์ํ์ค๋ฅผ ์์ฑํ๋ค. ์ด๋ ๊ฒ ์์ฑ๋ ์ฌ๋ฌ๊ฐ์ ์๋ก์ด ์ํ์ค๋ฅผ ํ๋์ .. 2022. 4. 18. typealias, associatedtype typealias typealias๋ ํ์ ์ ๋ถ์ผ ์ ์๋ ๋ณ์นญ associatedtype associatedType ์ Protocol์ ์ํ Generic An associated type gives a placeholder name to a type that’s used as part of the protocol. ์ฐธ๊ณ ์๋ฃ https://docs.swift.org/swift-book/LanguageGuide/Generics.html https://woongsios.tistory.com/97 2022. 4. 15. Non-Escaping Closure ์ Escaping Closure Non-Escaping ํด๋ก์ ๋ ํจ์์ ์ธ์๋ก ์ ๋ฌ๋์ ๋, ํจ์์ ์คํ์ด ์ข ๋ฃ๋๊ธฐ ์ ์ ์คํ๋๋ ํด๋ก์ . Escaping ํด๋ก์ ๋ ํด๋ก์ ๊ฐ ํจ์์ ์ธ์๋ก ์ ๋ฌ๋์ ๋, ํจ์์ ์คํ์ด ์ข ๋ฃ๋ ํ ์คํ๋๋ ํด๋ก์ . Non-Escaping ํด๋ก์ func runClosure(closure: () -> Void) { closure() } ํด๋ก์ ๊ฐ ์คํ๋๋ ์์๋ฅผ ๋ณด๋ฉด ํด๋ก์ ๊ฐ runClosure() ํจ์์ closure ์ธ์๋ก ์ ๋ฌ๋จ ํจ์ ์์์ closure() ๊ฐ ์คํ๋จ runClosure() ํจ์๊ฐ ๊ฐ์ ๋ฐํํ๊ณ ์ข ๋ฃ๋จ ์ด๋ ๊ฒ ํด๋ก์ ๊ฐ ํจ์๊ฐ ์ข ๋ฃ๋๊ธฐ ์ ์ ์คํ๋๊ธฐ ๋๋ฌธ์ closure๋ Non-Escaping ํด๋ก์ ์ด๋ค. Escaping ํด๋ก์ func makeRequest(_ completion: @.. 2021. 12. 28. ์ด์ 1 2 3 4 5 ๋ค์