I haven't seen any documentation on #available and what the valid platform arguments are, nor how to combine them.
For example if we want to check for the existence of the new Contacts framework on iOS and Mac, and watchOS in the same code, how do we "OR" these requirements together, and what are the valid IDs for Mac OS and watchOS?
// How do we specify this for iOS *and* Mac *and* watchOS? if #available(iOS 9, *) { setupWithContacts() }
It looks like the valid platform symbols are iOS, OSX and watchOS:
@available(iOS 9, *) @available(OSX 10.11, *) @available(watchOS 2, *) class ContactsData { let store = CNContactStore() }
but without an ability to use #available with multiple platforms in one clause, this because rather clunky to use.
if #available(iOS 9.0, *), #available(OSX 10.11, *), #available(watchOS 2, *) { ContactsData() }
...this results in the playground console output:
Playground execution failed: /var/folders/0v/626mc7q94fnd6zmh6z6b8qm40000gq/T/./lldb/40279/playground169.swift:14:5: error: 'ContactsData' is only available on iOS 9 or newer
ContactsData()
^
/var/folders/0v/626mc7q94fnd6zmh6z6b8qm40000gq/T/./lldb/40279/playground169.swift:14:5: note: guard with version check
ContactsData()
^