Files
swift-mirror/stdlib/objc/Foundation/CMakeLists.txt
Ted Kremenek 3d248270ca Add prototype for KVO API overlay ("KVOContext") to NSObject, and provide test case.
This change adds a new variant of "addObserver:forKeyPath:options:context:"
that takes a "KVOContext" instead of an unsafe void*.  The variant
delegates to the original method, but first 'retain's the object
before turning it into an unsafe pointer.  The API is then matched
with a variant of 'removeObserver:forKeyPath:context:' which
delegates to the original method and then 'release's it.

This vision here is that Swift clients of this API will use this
variant, and not the unsafe one.  A refinement (later) is to
not expose the original methods at all, and provide a new method
'observeValueForKeyPath:ofObject:change:kvoContext:' that implements
a thunk that delegates to 'observeValueForKeyPath:ofObject:change:context:'
and does the void* cast (which the code in the test case does).

This needs to go through API review; names are strawman names.

Swift SVN r17325
2014-05-03 20:06:28 +00:00

18 lines
396 B
CMake

set(SHARED_LIBRARY ON)
set(SWIFTFOUNDATION_SOURCES
Foundation.swift
KVO.swift
NSStringAPI.swift
Misc.mm
)
add_swift_library(swiftFoundation INSTALL
${SWIFTFOUNDATION_SOURCES}
DEPENDS swift_stdlib_core swiftObjectiveC swiftCoreGraphics)
add_swift_optimization_flags(swiftFoundation)
# Link against frameworks
target_link_libraries(swiftFoundation
"-framework Foundation")