Skip to content

Commit 8615f82

Browse files
alblueianpartridge
authored andcommitted
Provide an NSUnsupported macro for not supported implementations (#1150)
When developing cross-platform applications, an `NSUnimplemented()` is currently used to identify when a method is not and will not be implemented. Since `NSUnimplemented()` is used to also mean 'not yet implemented', using a distinct name for the same functionality will allow the two states to be distinguished, in the same way that `NSRequiresConcreteImplementation()` is used to indicate that a subtype must provide the behaviour.
1 parent eacd493 commit 8615f82

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Foundation/NSObjCRuntime.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,13 @@ internal func NSUnimplemented(_ fn: String = #function, file: StaticString = #fi
202202
fatalError("\(fn) is not yet implemented", file: file, line: line)
203203
}
204204

205+
internal func NSUnsupported(_ fn: String = #function, file: StaticString = #file, line: UInt = #line) -> Never {
206+
#if os(Android)
207+
NSLog("\(fn) is not supported on this platform. \(file):\(line)")
208+
#endif
209+
fatalError("\(fn) is not supported on this platform", file: file, line: line)
210+
}
211+
205212
internal func NSInvalidArgument(_ message: String, method: String = #function, file: StaticString = #file, line: UInt = #line) -> Never {
206213
fatalError("\(method): \(message)", file: file, line: line)
207214
}

0 commit comments

Comments
 (0)