Skip to content

Commit 70db425

Browse files
henrybettsparkera
authored andcommitted
NSSet/CFSet bridging (#630)
* Implement NSSet/CFSet bridge * Allow bridged dictionaries to be copied
1 parent 64f5359 commit 70db425

File tree

7 files changed

+206
-10
lines changed

7 files changed

+206
-10
lines changed

CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ struct _NSDictionaryBridge {
8181
CFIndex (*countForObject)(CFTypeRef dictionary, CFTypeRef value);
8282
void (*getObjects)(CFTypeRef dictionary, CFTypeRef _Nullable *_Nullable valuebuf, CFTypeRef _Nullable *_Nullable keybuf);
8383
void (*__apply)(CFTypeRef dictionary, void (*applier)(CFTypeRef key, CFTypeRef value, void *context), void *context);
84+
_Nonnull CFTypeRef (*_Nonnull copy)(CFTypeRef obj);
8485
};
8586

8687
struct _NSMutableDictionaryBridge {
@@ -92,11 +93,22 @@ struct _NSMutableDictionaryBridge {
9293
};
9394

9495
struct _NSSetBridge {
95-
96+
CFIndex (*_Nonnull count)(CFTypeRef obj);
97+
CFIndex (*countForValue)(CFTypeRef set, CFTypeRef value);
98+
bool (*containsValue)(CFTypeRef set, CFTypeRef value);
99+
_Nullable CFTypeRef (*_Nonnull getValue)(CFTypeRef set, CFTypeRef value);
100+
bool (*getValueIfPresent)(CFTypeRef set, CFTypeRef object, CFTypeRef _Nullable *_Nullable value);
101+
void (*getValues)(CFTypeRef set, CFTypeRef _Nullable *_Nullable values);
102+
void (*apply)(CFTypeRef set, void (*applier)(CFTypeRef value, void *context), void *context);
103+
_Nonnull CFTypeRef (*_Nonnull copy)(CFTypeRef obj);
96104
};
97105

98106
struct _NSMutableSetBridge {
99-
107+
void (*addValue)(CFTypeRef set, CFTypeRef value);
108+
void (*replaceValue)(CFTypeRef set, CFTypeRef value);
109+
void (*setValue)(CFTypeRef set, CFTypeRef value);
110+
void (*removeValue)(CFTypeRef set, CFTypeRef value);
111+
void (*removeAllValues)(CFTypeRef set);
100112
};
101113

102114
struct _NSStringBridge {

CoreFoundation/Collections.subproj/CFDictionary.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ CFHashRef CFDictionaryCreateCopy(CFAllocatorRef allocator, CFHashRef other) {
290290
__CFGenericValidateType(other, typeID);
291291
Boolean markImmutable = false;
292292
CFBasicHashRef ht = NULL;
293-
if (CF_IS_OBJC(typeID, other)) {
293+
if (CF_IS_OBJC(typeID, other) || CF_IS_SWIFT(typeID, other)) {
294294
if (objc_collectingEnabled()) {
295295
CFIndex numValues = CFDictionaryGetCount(other);
296296
const_any_pointer_t vbuffer[256], kbuffer[256];
@@ -314,7 +314,11 @@ CFHashRef CFDictionaryCreateCopy(CFAllocatorRef allocator, CFHashRef other) {
314314
}
315315
else { // non-GC
316316
#if CFDictionary || CFSet
317+
#if DEPLOYMENT_RUNTIME_SWIFT
318+
ht = (CFBasicHashRef)CF_SWIFT_CALLV(other, NSDictionary.copy);
319+
#else
317320
ht = (CFBasicHashRef)CF_OBJC_CALLV((id)other, copyWithZone:NULL);
321+
#endif
318322
#elif CFBag
319323
CFIndex numValues = CFDictionaryGetCount(other);
320324
const_any_pointer_t vbuffer[256];
@@ -350,7 +354,7 @@ CFMutableHashRef CFDictionaryCreateMutableCopy(CFAllocatorRef allocator, CFIndex
350354
__CFGenericValidateType(other, typeID);
351355
CFAssert(0 <= capacity, __kCFLogAssertion, "%s(): capacity (%ld) cannot be less than zero", __PRETTY_FUNCTION__, capacity);
352356
CFBasicHashRef ht = NULL;
353-
if (CF_IS_OBJC(typeID, other)) {
357+
if (CF_IS_OBJC(typeID, other) || CF_IS_SWIFT(typeID, other)) {
354358
CFIndex numValues = CFDictionaryGetCount(other);
355359
const_any_pointer_t vbuffer[256], kbuffer[256];
356360
const_any_pointer_t *vlist = (numValues <= 256) ? vbuffer : (const_any_pointer_t *)CFAllocatorAllocate(kCFAllocatorSystemDefault, numValues * sizeof(const_any_pointer_t), 0);

CoreFoundation/Collections.subproj/CFSet.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ CFHashRef CFSetCreateCopy(CFAllocatorRef allocator, CFHashRef other) {
289289
__CFGenericValidateType(other, typeID);
290290
Boolean markImmutable = false;
291291
CFBasicHashRef ht = NULL;
292-
if (CF_IS_OBJC(typeID, other)) {
292+
if (CF_IS_OBJC(typeID, other) || CF_IS_SWIFT(typeID, other)) {
293293
if (objc_collectingEnabled()) {
294294
CFIndex numValues = CFSetGetCount(other);
295295
const_any_pointer_t vbuffer[256], kbuffer[256];
@@ -313,7 +313,11 @@ CFHashRef CFSetCreateCopy(CFAllocatorRef allocator, CFHashRef other) {
313313
}
314314
else { // non-GC
315315
#if CFDictionary || CFSet
316+
#if DEPLOYMENT_RUNTIME_SWIFT
317+
ht = (CFBasicHashRef)CF_SWIFT_CALLV(other, NSSet.copy);
318+
#else
316319
ht = (CFBasicHashRef)CF_OBJC_CALLV((id)other, copyWithZone:NULL);
320+
#endif
317321
#elif CFBag
318322
CFIndex numValues = CFSetGetCount(other);
319323
const_any_pointer_t vbuffer[256];
@@ -349,7 +353,7 @@ CFMutableHashRef CFSetCreateMutableCopy(CFAllocatorRef allocator, CFIndex capaci
349353
__CFGenericValidateType(other, typeID);
350354
CFAssert(0 <= capacity, __kCFLogAssertion, "%s(): capacity (%ld) cannot be less than zero", __PRETTY_FUNCTION__, capacity);
351355
CFBasicHashRef ht = NULL;
352-
if (CF_IS_OBJC(typeID, other)) {
356+
if (CF_IS_OBJC(typeID, other) || CF_IS_SWIFT(typeID, other)) {
353357
CFIndex numValues = CFSetGetCount(other);
354358
const_any_pointer_t vbuffer[256], kbuffer[256];
355359
const_any_pointer_t *vlist = (numValues <= 256) ? vbuffer : (const_any_pointer_t *)CFAllocatorAllocate(kCFAllocatorSystemDefault, numValues * sizeof(const_any_pointer_t), 0);
@@ -382,6 +386,7 @@ CFIndex CFSetGetCount(CFHashRef hc) {
382386
if (CFDictionary) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), CFIndex, (NSDictionary *)hc, count);
383387
#endif
384388
#if CFSet
389+
if (CFSet) CF_SWIFT_FUNCDISPATCHV(CFSetGetTypeID(), CFIndex, (CFSwiftRef)hc, NSSet.count);
385390
if (CFSet) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), CFIndex, (NSSet *)hc, count);
386391
#endif
387392
__CFGenericValidateType(hc, CFSetGetTypeID());
@@ -398,6 +403,7 @@ CFIndex CFSetGetCountOfValue(CFHashRef hc, const_any_pointer_t key) {
398403
if (CFDictionary) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), CFIndex, (NSDictionary *)hc, countForKey:(id)key);
399404
#endif
400405
#if CFSet
406+
if (CFSet) CF_SWIFT_FUNCDISPATCHV(CFSetGetTypeID(), CFIndex, (CFSwiftRef)hc, NSSet.countForValue, key);
401407
if (CFSet) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), CFIndex, (NSSet *)hc, countForObject:(id)key);
402408
#endif
403409
__CFGenericValidateType(hc, CFSetGetTypeID());
@@ -414,6 +420,7 @@ Boolean CFSetContainsValue(CFHashRef hc, const_any_pointer_t key) {
414420
if (CFDictionary) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), char, (NSDictionary *)hc, containsKey:(id)key);
415421
#endif
416422
#if CFSet
423+
if (CFSet) CF_SWIFT_FUNCDISPATCHV(CFSetGetTypeID(), char, (CFSwiftRef)hc, NSSet.containsValue, key);
417424
if (CFSet) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), char, (NSSet *)hc, containsObject:(id)key);
418425
#endif
419426
__CFGenericValidateType(hc, CFSetGetTypeID());
@@ -425,6 +432,7 @@ const_any_pointer_t CFSetGetValue(CFHashRef hc, const_any_pointer_t key) {
425432
if (CFDictionary) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), const_any_pointer_t, (NSDictionary *)hc, objectForKey:(id)key);
426433
#endif
427434
#if CFSet
435+
if (CFSet) CF_SWIFT_FUNCDISPATCHV(CFSetGetTypeID(), CFTypeRef, (CFSwiftRef)hc, NSSet.getValue, key);
428436
if (CFSet) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), const_any_pointer_t, (NSSet *)hc, member:(id)key);
429437
#endif
430438
__CFGenericValidateType(hc, CFSetGetTypeID());
@@ -437,6 +445,7 @@ Boolean CFSetGetValueIfPresent(CFHashRef hc, const_any_pointer_t key, const_any_
437445
if (CFDictionary) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), Boolean, (NSDictionary *)hc, __getValue:(id *)value forKey:(id)key);
438446
#endif
439447
#if CFSet
448+
if (CFSet) CF_SWIFT_FUNCDISPATCHV(CFSetGetTypeID(), Boolean, (CFSwiftRef)hc, NSSet.getValueIfPresent, key, value);
440449
if (CFSet) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), Boolean, (NSSet *)hc, __getValue:(id *)value forObj:(id)key);
441450
#endif
442451
__CFGenericValidateType(hc, CFSetGetTypeID());
@@ -495,6 +504,7 @@ void CFSetGetValues(CFHashRef hc, const_any_pointer_t *keybuf) {
495504
if (CFDictionary) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), void, (NSDictionary *)hc, getObjects:(id *)valuebuf andKeys:(id *)keybuf);
496505
#endif
497506
#if CFSet
507+
if (CFSet) CF_SWIFT_FUNCDISPATCHV(CFSetGetTypeID(), void, (CFSwiftRef)hc, NSSet.getValues, keybuf);
498508
if (CFSet) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), void, (NSSet *)hc, getObjects:(id *)keybuf);
499509
#endif
500510
__CFGenericValidateType(hc, CFSetGetTypeID());
@@ -522,6 +532,7 @@ void CFSetApplyFunction(CFHashRef hc, CFSetApplierFunction applier, any_pointer_
522532
if (CFDictionary) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), void, (NSDictionary *)hc, __apply:(void (*)(const void *, const void *, void *))applier context:(void *)context);
523533
#endif
524534
#if CFSet
535+
if (CFSet) CF_SWIFT_FUNCDISPATCHV(CFSetGetTypeID(), void, (CFSwiftRef)hc, NSSet.apply, applier, context);
525536
if (CFSet) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), void, (NSSet *)hc, __applyValues:(void (*)(const void *, void *))applier context:(void *)context);
526537
#endif
527538
__CFGenericValidateType(hc, CFSetGetTypeID());
@@ -601,6 +612,7 @@ void CFSetAddValue(CFMutableHashRef hc, const_any_pointer_t key) {
601612
if (CFDictionary) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), void, (NSMutableDictionary *)hc, __addObject:(id)value forKey:(id)key);
602613
#endif
603614
#if CFSet
615+
if (CFSet) CF_SWIFT_FUNCDISPATCHV(CFSetGetTypeID(), void, (CFSwiftRef)hc, NSMutableSet.addValue, key);
604616
if (CFSet) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), void, (NSMutableSet *)hc, addObject:(id)key);
605617
#endif
606618
__CFGenericValidateType(hc, CFSetGetTypeID());
@@ -624,6 +636,7 @@ void CFSetReplaceValue(CFMutableHashRef hc, const_any_pointer_t key) {
624636
if (CFDictionary) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), void, (NSMutableDictionary *)hc, replaceObject:(id)value forKey:(id)key);
625637
#endif
626638
#if CFSet
639+
if (CFSet) CF_SWIFT_FUNCDISPATCHV(CFSetGetTypeID(), void, (CFSwiftRef)hc, NSMutableSet.replaceValue, key);
627640
if (CFSet) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), void, (NSMutableSet *)hc, replaceObject:(id)key);
628641
#endif
629642
__CFGenericValidateType(hc, CFSetGetTypeID());
@@ -647,6 +660,7 @@ void CFSetSetValue(CFMutableHashRef hc, const_any_pointer_t key) {
647660
if (CFDictionary) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), void, (NSMutableDictionary *)hc, __setObject:(id)value forKey:(id)key);
648661
#endif
649662
#if CFSet
663+
if (CFSet) CF_SWIFT_FUNCDISPATCHV(CFSetGetTypeID(), void, (CFSwiftRef)hc, NSMutableSet.setValue, key);
650664
if (CFSet) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), void, (NSMutableSet *)hc, setObject:(id)key);
651665
#endif
652666
__CFGenericValidateType(hc, CFSetGetTypeID());
@@ -665,6 +679,7 @@ void CFSetRemoveValue(CFMutableHashRef hc, const_any_pointer_t key) {
665679
if (CFDictionary) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), void, (NSMutableDictionary *)hc, removeObjectForKey:(id)key);
666680
#endif
667681
#if CFSet
682+
if (CFSet) CF_SWIFT_FUNCDISPATCHV(CFSetGetTypeID(), void, (CFSwiftRef)hc, NSMutableSet.removeValue, key);
668683
if (CFSet) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), void, (NSMutableSet *)hc, removeObject:(id)key);
669684
#endif
670685
__CFGenericValidateType(hc, CFSetGetTypeID());
@@ -682,6 +697,7 @@ void CFSetRemoveAllValues(CFMutableHashRef hc) {
682697
if (CFDictionary) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), void, (NSMutableDictionary *)hc, removeAllObjects);
683698
#endif
684699
#if CFSet
700+
if (CFSet) CF_SWIFT_FUNCDISPATCHV(CFSetGetTypeID(), void, (CFSwiftRef)hc, NSMutableSet.removeAllValues);
685701
if (CFSet) CF_OBJC_FUNCDISPATCHV(CFSetGetTypeID(), void, (NSMutableSet *)hc, removeAllObjects);
686702
#endif
687703
__CFGenericValidateType(hc, CFSetGetTypeID());

Foundation/NSCFDictionary.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,3 +213,7 @@ internal func _CFSwiftDictionaryRemoveValue(_ dictionary: AnyObject, key: AnyOb
213213
internal func _CFSwiftDictionaryRemoveAllValues(_ dictionary: AnyObject) {
214214
(dictionary as! NSMutableDictionary).removeAllObjects()
215215
}
216+
217+
internal func _CFSwiftDictionaryCreateCopy(_ dictionary: AnyObject) -> Unmanaged<AnyObject> {
218+
return Unmanaged<AnyObject>.passRetained((dictionary as! NSDictionary).copy() as! NSObject)
219+
}

Foundation/NSCFSet.swift

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,148 @@ internal final class _NSCFSet : NSMutableSet {
3131
override var classForCoder: AnyClass {
3232
return NSMutableSet.self
3333
}
34+
35+
override var count: Int {
36+
return CFSetGetCount(_cfObject)
37+
}
38+
39+
override func member(_ object: Any) -> Any? {
40+
41+
guard let value = CFSetGetValue(_cfObject, unsafeBitCast(_SwiftValue.store(object), to: UnsafeRawPointer.self)) else {
42+
return nil
43+
}
44+
return _SwiftValue.fetch(unsafeBitCast(value, to: AnyObject.self))
45+
46+
}
47+
48+
override func objectEnumerator() -> NSEnumerator {
49+
50+
var objArray: [AnyObject] = []
51+
let cf = _cfObject
52+
let count = CFSetGetCount(cf)
53+
54+
let objects = UnsafeMutablePointer<UnsafeRawPointer?>.allocate(capacity: count)
55+
CFSetGetValues(cf, objects)
56+
57+
for idx in 0..<count {
58+
let obj = unsafeBitCast(objects.advanced(by: idx).pointee!, to: AnyObject.self)
59+
objArray.append(obj)
60+
}
61+
objects.deinitialize()
62+
objects.deallocate(capacity: count)
63+
64+
return NSGeneratorEnumerator(objArray.makeIterator())
65+
66+
}
67+
68+
override func add(_ object: Any) {
69+
CFSetAddValue(_cfMutableObject, unsafeBitCast(_SwiftValue.store(object), to: UnsafeRawPointer.self))
70+
}
71+
72+
override func remove(_ object: Any) {
73+
CFSetRemoveValue(_cfMutableObject, unsafeBitCast(_SwiftValue.store(object), to: UnsafeRawPointer.self))
74+
}
75+
76+
}
77+
78+
internal func _CFSwiftSetGetCount(_ set: AnyObject) -> CFIndex {
79+
return (set as! NSSet).count
80+
}
81+
82+
internal func _CFSwiftSetGetCountOfValue(_ set: AnyObject, value: AnyObject) -> CFIndex {
83+
if _CFSwiftSetContainsValue(set, value: value) {
84+
return 1
85+
} else {
86+
return 0
87+
}
88+
}
89+
90+
internal func _CFSwiftSetContainsValue(_ set: AnyObject, value: AnyObject) -> Bool {
91+
return _CFSwiftSetGetValue(set, value: value) != nil
92+
}
93+
94+
internal func _CFSwiftSetGetValues(_ set: AnyObject, _ values: UnsafeMutablePointer<Unmanaged<AnyObject>?>?) {
95+
96+
var idx = 0
97+
if values == nil {
98+
return
99+
}
100+
101+
let set = set as! NSSet
102+
if type(of: set) === NSSet.self || type(of: set) === NSMutableSet.self {
103+
for obj in set._storage {
104+
values?[idx] = Unmanaged<AnyObject>.passUnretained(obj)
105+
idx += 1
106+
}
107+
} else {
108+
set.enumerateObjects( { v, _ in
109+
let value = _SwiftValue.store(v)
110+
values?[idx] = Unmanaged<AnyObject>.passUnretained(value)
111+
set._storage.update(with: value)
112+
idx += 1
113+
})
114+
}
115+
}
116+
117+
internal func _CFSwiftSetGetValue(_ set: AnyObject, value: AnyObject) -> Unmanaged<AnyObject>? {
118+
let set = set as! NSSet
119+
if type(of: set) === NSSet.self || type(of: set) === NSMutableSet.self {
120+
if let idx = set._storage.index(of: value as! NSObject){
121+
return Unmanaged<AnyObject>.passUnretained(set._storage[idx])
122+
}
123+
124+
} else {
125+
let v = _SwiftValue.store(set.member(value))
126+
if let obj = v {
127+
set._storage.update(with: obj)
128+
return Unmanaged<AnyObject>.passUnretained(obj)
129+
}
130+
}
131+
return nil
132+
}
133+
134+
internal func _CFSwiftSetGetValueIfPresent(_ set: AnyObject, object: AnyObject, value: UnsafeMutablePointer<Unmanaged<AnyObject>?>?) -> Bool {
135+
if let val = _CFSwiftSetGetValue(set, value: object) {
136+
value?.pointee = val
137+
return true
138+
} else {
139+
value?.pointee = nil
140+
return false
141+
}
142+
}
143+
144+
internal func _CFSwiftSetApplyFunction(_ set: AnyObject, applier: @convention(c) (AnyObject, UnsafeMutableRawPointer) -> Void, context: UnsafeMutableRawPointer) {
145+
(set as! NSSet).enumerateObjects({ value, _ in
146+
applier(_SwiftValue.store(value), context)
147+
})
148+
}
149+
150+
internal func _CFSwiftSetAddValue(_ set: AnyObject, value: AnyObject) {
151+
(set as! NSMutableSet).add(value)
152+
}
153+
154+
internal func _CFSwiftSetReplaceValue(_ set: AnyObject, value: AnyObject) {
155+
let set = set as! NSMutableSet
156+
if (set.contains(value)){
157+
set.remove(value)
158+
set.add(value)
159+
}
160+
}
161+
162+
internal func _CFSwiftSetSetValue(_ set: AnyObject, value: AnyObject) {
163+
let set = set as! NSMutableSet
164+
set.remove(value)
165+
set.add(value)
166+
}
167+
168+
internal func _CFSwiftSetRemoveValue(_ set: AnyObject, value: AnyObject) {
169+
(set as! NSMutableSet).remove(value)
170+
}
171+
172+
internal func _CFSwiftSetRemoveAllValues(_ set: AnyObject) {
173+
(set as! NSMutableSet).removeAllObjects()
174+
}
175+
176+
internal func _CFSwiftSetCreateCopy(_ set: AnyObject) -> Unmanaged<AnyObject> {
177+
return Unmanaged<AnyObject>.passRetained((set as! NSSet).copy() as! NSObject)
34178
}

Foundation/NSSet.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ open class NSSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSCodi
2626
NSRequiresConcreteImplementation()
2727
}
2828
let value = _SwiftValue.store(object)
29-
if _storage.contains(value) {
30-
return object // this is not exactly the same behavior, but it is reasonably close
31-
}
32-
return nil
29+
guard let idx = _storage.index(of: value) else { return nil }
30+
return _storage[idx]
3331
}
3432

3533
open func objectEnumerator() -> NSEnumerator {
@@ -286,6 +284,10 @@ extension CFSet : _NSBridgeable, _SwiftBridgeable {
286284
internal var _swiftObject: Set<NSObject> { return _nsObject._swiftObject }
287285
}
288286

287+
extension NSMutableSet {
288+
internal var _cfMutableObject: CFMutableSet { return unsafeBitCast(self, to: CFMutableSet.self) }
289+
}
290+
289291
extension Set : _NSBridgeable, _CFBridgeable {
290292
internal var _nsObject: NSSet { return _bridgeToObjectiveC() }
291293
internal var _cfObject: CFSet { return _nsObject._cfObject }

Foundation/NSSwiftRuntime.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,19 @@ internal func __CFInitializeSwift() {
100100
__CFSwiftBridge.NSObject.hash = _CFSwiftGetHash
101101
__CFSwiftBridge.NSObject._cfTypeID = _CFSwiftGetTypeID
102102

103+
__CFSwiftBridge.NSSet.count = _CFSwiftSetGetCount
104+
__CFSwiftBridge.NSSet.countForValue = _CFSwiftSetGetCountOfValue
105+
__CFSwiftBridge.NSSet.containsValue = _CFSwiftSetContainsValue
106+
__CFSwiftBridge.NSSet.getValue = _CFSwiftSetGetValue
107+
__CFSwiftBridge.NSSet.getValueIfPresent = _CFSwiftSetGetValueIfPresent
108+
__CFSwiftBridge.NSSet.getValues = _CFSwiftSetGetValues
109+
__CFSwiftBridge.NSSet.copy = _CFSwiftSetCreateCopy
110+
111+
__CFSwiftBridge.NSMutableSet.addValue = _CFSwiftSetAddValue
112+
__CFSwiftBridge.NSMutableSet.replaceValue = _CFSwiftSetReplaceValue
113+
__CFSwiftBridge.NSMutableSet.setValue = _CFSwiftSetSetValue
114+
__CFSwiftBridge.NSMutableSet.removeValue = _CFSwiftSetRemoveValue
115+
__CFSwiftBridge.NSMutableSet.removeAllValues = _CFSwiftSetRemoveAllValues
103116

104117
__CFSwiftBridge.NSArray.count = _CFSwiftArrayGetCount
105118
__CFSwiftBridge.NSArray.objectAtIndex = _CFSwiftArrayGetValueAtIndex
@@ -123,6 +136,7 @@ internal func __CFInitializeSwift() {
123136
__CFSwiftBridge.NSDictionary.countForObject = _CFSwiftDictionaryGetCountOfValue
124137
__CFSwiftBridge.NSDictionary.getObjects = _CFSwiftDictionaryGetValuesAndKeys
125138
__CFSwiftBridge.NSDictionary.__apply = _CFSwiftDictionaryApplyFunction
139+
__CFSwiftBridge.NSDictionary.copy = _CFSwiftDictionaryCreateCopy
126140

127141
__CFSwiftBridge.NSMutableDictionary.__addObject = _CFSwiftDictionaryAddValue
128142
__CFSwiftBridge.NSMutableDictionary.replaceObject = _CFSwiftDictionaryReplaceValue

0 commit comments

Comments
 (0)