== ์ฐ์ฐ์
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/===(_:_:)
'iOS ๐ > Swift' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Property Wrapper (0) | 2022.04.28 |
---|---|
self vs Self (0) | 2022.04.27 |
RxSwift Operator : Map, FlatMap (0) | 2022.04.18 |
typealias, associatedtype (0) | 2022.04.15 |
Non-Escaping Closure ์ Escaping Closure (0) | 2021.12.28 |