@@ -75,16 +75,6 @@ func _convertStringToNSString(string: String) -> NSString {
75
75
return string. _bridgeToObjectiveC ( )
76
76
}
77
77
78
- @warn_unused_result
79
- @_semantics ( " convertFromObjectiveC " )
80
- public // COMPILER_INTRINSIC
81
- func _convertNSStringToString( nsstring: NSString ? ) -> String {
82
- if nsstring == nil { return " " }
83
- var result : String ?
84
- String . _forceBridgeFromObjectiveC ( nsstring!, result: & result)
85
- return result!
86
- }
87
-
88
78
extension NSString : StringLiteralConvertible {
89
79
/// Create an instance initialized to `value`.
90
80
public required convenience init ( unicodeScalarLiteral value: StaticString ) {
@@ -461,33 +451,6 @@ extension NSArray : ArrayLiteralConvertible {
461
451
}
462
452
}
463
453
464
- /// The entry point for converting `NSArray` to `Array` in bridge
465
- /// thunks. Used, for example, to expose :
466
- ///
467
- /// func f([NSView]) {}
468
- ///
469
- /// to Objective-C code as a method that accepts an `NSArray`. This operation
470
- /// is referred to as a "forced conversion" in ../../../docs/Arrays.rst
471
- @warn_unused_result
472
- @_semantics ( " convertFromObjectiveC " )
473
- public func _convertNSArrayToArray< T> ( source: NSArray ? ) -> [ T ] {
474
- if _slowPath ( source == nil ) { return [ ] }
475
- var result : [ T ] ?
476
- Array . _forceBridgeFromObjectiveC ( source!, result: & result)
477
- return result!
478
- }
479
-
480
- /// The entry point for converting `Array` to `NSArray` in bridge
481
- /// thunks. Used, for example, to expose :
482
- ///
483
- /// func f() -> [NSView] { return [] }
484
- ///
485
- /// to Objective-C code as a method that returns an `NSArray`.
486
- @warn_unused_result
487
- public func _convertArrayToNSArray< T> ( array: [ T ] ) -> NSArray {
488
- return array. _bridgeToObjectiveC ( )
489
- }
490
-
491
454
extension Array : _ObjectiveCBridgeable {
492
455
493
456
/// Private initializer used for bridging.
@@ -626,54 +589,6 @@ extension Dictionary {
626
589
}
627
590
}
628
591
629
- /// The entry point for bridging `NSDictionary` to `Dictionary` in bridge
630
- /// thunks. Used, for example, to expose:
631
- ///
632
- /// func f([String : String]) {}
633
- ///
634
- /// to Objective-C code as a method that accepts an `NSDictionary`.
635
- ///
636
- /// This is a forced downcast. This operation should have O(1) complexity
637
- /// when `Key` and `Value` are bridged verbatim.
638
- ///
639
- /// The cast can fail if bridging fails. The actual checks and bridging can be
640
- /// deferred.
641
- @warn_unused_result
642
- @_semantics ( " convertFromObjectiveC " )
643
- public func _convertNSDictionaryToDictionary<
644
- Key : Hashable , Value
645
- > ( d: NSDictionary ? ) -> [ Key : Value ] {
646
- // Note: there should be *a good justification* for doing something else
647
- // than just dispatching to `_forceBridgeFromObjectiveC`.
648
- if _slowPath ( d == nil ) { return [ : ] }
649
- var result : [ Key : Value ] ?
650
- Dictionary . _forceBridgeFromObjectiveC ( d!, result: & result)
651
- return result!
652
- }
653
-
654
- // FIXME: right now the following is O(n), not O(1).
655
-
656
- /// The entry point for bridging `Dictionary` to `NSDictionary` in bridge
657
- /// thunks. Used, for example, to expose:
658
- ///
659
- /// func f() -> [String : String] {}
660
- ///
661
- /// to Objective-C code as a method that returns an `NSDictionary`.
662
- ///
663
- /// This is a forced downcast. This operation should have O(1) complexity.
664
- ///
665
- /// The cast can fail if bridging fails. The actual checks and bridging can be
666
- /// deferred.
667
- @warn_unused_result
668
- public func _convertDictionaryToNSDictionary< Key, Value> (
669
- d: [ Key : Value ]
670
- ) -> NSDictionary {
671
-
672
- // Note: there should be *a good justification* for doing something else
673
- // than just dispatching to `_bridgeToObjectiveC`.
674
- return d. _bridgeToObjectiveC ( )
675
- }
676
-
677
592
// Dictionary<Key, Value> is conditionally bridged to NSDictionary
678
593
extension Dictionary : _ObjectiveCBridgeable {
679
594
public static func _getObjectiveCType( ) -> Any . Type {
@@ -925,45 +840,6 @@ extension NSIndexSet : Sequence {
925
840
}
926
841
}
927
842
928
- // FIXME: right now the following is O(n), not O(1).
929
-
930
- /// The entry point for bridging `Set` to `NSSet` in bridge
931
- /// thunks. Used, for example, to expose:
932
- ///
933
- /// func f() -> Set<String> {}
934
- ///
935
- /// to Objective-C code as a method that returns an `NSSet`.
936
- ///
937
- /// This is a forced downcast. This operation should have O(1) complexity.
938
- ///
939
- /// The cast can fail if bridging fails. The actual checks and bridging can be
940
- /// deferred.
941
- @warn_unused_result
942
- public func _convertSetToNSSet< T> ( s: Set < T > ) -> NSSet {
943
- return s. _bridgeToObjectiveC ( )
944
- }
945
-
946
- /// The entry point for bridging `NSSet` to `Set` in bridge
947
- /// thunks. Used, for example, to expose:
948
- ///
949
- /// func f(Set<String>) {}
950
- ///
951
- /// to Objective-C code as a method that accepts an `NSSet`.
952
- ///
953
- /// This is a forced downcast. This operation should have O(1) complexity
954
- /// when `T` is bridged verbatim.
955
- ///
956
- /// The cast can fail if bridging fails. The actual checks and bridging can be
957
- /// deferred.
958
- @warn_unused_result
959
- @_semantics ( " convertFromObjectiveC " )
960
- public func _convertNSSetToSet< T : Hashable > ( s: NSSet ? ) -> Set < T > {
961
- if _slowPath ( s == nil ) { return [ ] }
962
- var result : Set < T > ?
963
- Set . _forceBridgeFromObjectiveC ( s!, result: & result)
964
- return result!
965
- }
966
-
967
843
// Set<Element> is conditionally bridged to NSSet
968
844
extension Set : _ObjectiveCBridgeable {
969
845
public static func _getObjectiveCType( ) -> Any . Type {
0 commit comments