@@ -130,12 +130,16 @@ class TestUserInfo : TestUserInfoSuper {
130
130
func test_classForCoder( ) {
131
131
// confirm internal bridged impl types are not exposed to archival machinery
132
132
// we have to be circuitous here, as bridging makes it very difficult to confirm this
133
- let note = Notification ( name: Notification . Name ( rawValue: " TestSwiftNotification " ) , userInfo: [ AnyHashable ( " key " ) : " value " ] )
134
- let archivedNote = NSKeyedArchiver . archivedData ( withRootObject: note)
135
- let noteAsPlist = try ! PropertyListSerialization . propertyList ( from: archivedNote, options: [ ] , format: nil )
136
- let plistAsData = try ! PropertyListSerialization . data ( fromPropertyList: noteAsPlist, format: . xml, options: 0 )
137
- let xml = NSString ( data: plistAsData, encoding: String . Encoding. utf8. rawValue) !
138
- expectEqual ( xml. range ( of: " _NSUserInfoDictionary " ) . location, NSNotFound)
133
+ //
134
+ // Gated on the availability of NSKeyedArchiver.archivedData(withRootObject:).
135
+ if #available( macOS 10 . 11 , iOS 9 . 0 , tvOS 9 . 0 , watchOS 2 . 0 , * ) {
136
+ let note = Notification ( name: Notification . Name ( rawValue: " TestSwiftNotification " ) , userInfo: [ AnyHashable ( " key " ) : " value " ] )
137
+ let archivedNote = NSKeyedArchiver . archivedData ( withRootObject: note)
138
+ let noteAsPlist = try ! PropertyListSerialization . propertyList ( from: archivedNote, options: [ ] , format: nil )
139
+ let plistAsData = try ! PropertyListSerialization . data ( fromPropertyList: noteAsPlist, format: . xml, options: 0 )
140
+ let xml = NSString ( data: plistAsData, encoding: String . Encoding. utf8. rawValue) !
141
+ expectEqual ( xml. range ( of: " _NSUserInfoDictionary " ) . location, NSNotFound)
142
+ }
139
143
}
140
144
141
145
func test_AnyHashableContainingNotification( ) {
0 commit comments