버전분기 샘플

개발/iOS 2021. 8. 2. 13:36
반응형
if #available(iOS 11.0, *) {
  // iOS 11 (or newer) ObjC code
} else {
  // iOS 10 or older code
}


// Starting Xcode 9, in Objective-C:
if (@available(iOS 11, *)) {
  // iOS 11 (or newer) ObjC code
} else {
  // iOS 10 or older code
}


#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_6_0
  // iOS 6+ code here
#else
  // Pre iOS 6 code here
#endif


#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0
  // iOS 11+ code here
#else
  // Pre iOS 11 code here
#endif


Starting Xcode 7, in Swift:
if #available(iOS 11, *) {
  // iOS 11 (or newer) Swift code
} else {
  // iOS 10 or older code
}


if (@available(iOS 13.0, tvOS 13.0, *)) {
  // iOS 13+ code here
}
반응형
블로그 이미지

SKY STORY

,