λ°μν
π λͺ©λ‘
- is
- as
π is
is λ νμ μ ꡬλΆν λ μ¬μ© λ©λλ€.
print("TypeCheck \(2 is Int)") // true
π as
as λ νμ μ μΊμ€ν ν λ μ¬μ© λ©λλ€.
asλ !
, ?
λ‘ μ¬μ© ν μ μμ΅λλ€.
var testType: String = "2"
var testType2 = testType as? Int
if(testType2 is Int?) {
print("HELLO")
}
λ°μν
'Swift' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
Swift νλ‘ν μ½ (0) | 2021.11.28 |
---|---|
Swift asset μ guard (0) | 2021.11.28 |
Swift ꡬ쑰체μ ν΄λμ€ (0) | 2021.11.21 |
Swift μ΅μ λ (0) | 2021.11.20 |
Swift ν¨μ (0) | 2021.11.20 |