SWIFT 학습노트 02
let decimalDouble = 12.1875
let exponentDouble = 1.21875e1
let hexadecimalDouble = 0xC.3p0//==12+3*(1/16)
2,//유형 별칭, typealias 키워드로 유형 별칭 정의
typealias AudioSample = UInt16
var maxAmplitudeFound = AudioSample.min
3、//원조
let http404Error = (404, "Not Found") // http404Error (Int, String), (404, "Not Found")
let http200Status = (statusCode: 200, description: "OK") //
let (justTheStatusCode, _) = http404Error
println("The status code is\(justTheStatusCode)") // "The status code is 404"
println("The status code is \(http404Error.0)") // "The status code is 404"
4、사용!존재하지 않는 선택 가능한 값을 가져오면 실행 중 오류가 발생할 수 있습니다.사용!값을 강제로 해석하기 전에 nil이 아닌 값을 선택할 수 있는지 확인해야 합니다.
5. Swift의 nil과 Objective-C의 nil은 다르다.Objective-C에서 nil은 객체가 없는 포인터입니다.Swift에서 nil은 포인터가 아닙니다. 이것은 값이 부족하다는 것을 나타내는 확실한 값입니다.모든 종류의 선택할 수 있는 상태는 대상 형식뿐만 아니라 nil로 설정할 수 있습니다.
2014년 06월 30일
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
백그라운드에서 값을 계산하고 Swift 동시성 이후에 결과 사용값을 계산해야 하고 메인 스레드를 차단하지 않으려면 계산된 값을 반환하는 Swift Task 구조에서 해당 값을 계산하면 됩니다. Swift 동시성 이전에는 백그라운드 대기열로 이동하여 필요한 값을 계산하고 필요한 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.