@@ -752,7 +752,7 @@ public struct URL : ReferenceConvertible, Equatable {
752
752
return self
753
753
}
754
754
755
- if let result = _url. deletingLastPathComponent. map ( { URL ( reference : $0 as NSURL ) } ) {
755
+ if let result = _url. deletingLastPathComponent {
756
756
return result
757
757
} else {
758
758
return self
@@ -785,7 +785,7 @@ public struct URL : ReferenceConvertible, Equatable {
785
785
return self
786
786
}
787
787
788
- if let result = _url. deletingPathExtension. map ( { URL ( reference : $0 as NSURL ) } ) {
788
+ if let result = _url. deletingPathExtension {
789
789
return result
790
790
} else {
791
791
return self
@@ -837,7 +837,7 @@ public struct URL : ReferenceConvertible, Equatable {
837
837
/// Returns a `URL` with any instances of ".." or "." removed from its path.
838
838
public var standardized : URL {
839
839
// The NSURL API can only return nil in case of file reference URL, which we should not be
840
- if let result = _url. standardized. map ( { URL ( reference : $0 as NSURL ) } ) {
840
+ if let result = _url. standardized {
841
841
return result
842
842
} else {
843
843
return self
@@ -856,7 +856,7 @@ public struct URL : ReferenceConvertible, Equatable {
856
856
/// If the `isFileURL` is false, this method returns `self`.
857
857
public var standardizedFileURL : URL {
858
858
// NSURL should not return nil here unless this is a file reference URL, which should be impossible
859
- if let result = _url. standardizingPath. map ( { URL ( reference : $0 as NSURL ) } ) {
859
+ if let result = _url. standardizingPath {
860
860
return result
861
861
} else {
862
862
return self
@@ -868,7 +868,7 @@ public struct URL : ReferenceConvertible, Equatable {
868
868
/// If the `isFileURL` is false, this method returns `self`.
869
869
public func resolvingSymlinksInPath( ) -> URL {
870
870
// NSURL should not return nil here unless this is a file reference URL, which should be impossible
871
- if let result = _url. resolvingSymlinksInPath. map ( { URL ( reference : $0 as NSURL ) } ) {
871
+ if let result = _url. resolvingSymlinksInPath {
872
872
return result
873
873
} else {
874
874
return self
@@ -927,26 +927,6 @@ public struct URL : ReferenceConvertible, Equatable {
927
927
_url. removeCachedResourceValue ( forKey: key)
928
928
}
929
929
930
- @available ( * , unavailable, message: " Use struct URLResourceValues and URL.setResourceValues(_:) instead " )
931
- public func setResourceValue( _ value: AnyObject ? , forKey key: URLResourceKey ) throws {
932
- fatalError ( )
933
- }
934
-
935
- @available ( * , unavailable, message: " Use struct URLResourceValues and URL.setResourceValues(_:) instead " )
936
- public func setResourceValues( _ keyedValues: [ URLResourceKey : AnyObject ] ) throws {
937
- fatalError ( )
938
- }
939
-
940
- @available ( * , unavailable, message: " Use struct URLResourceValues and URL.resourceValues(forKeys:) instead " )
941
- public func resourceValues( forKeys keys: [ URLResourceKey ] ) throws -> [ URLResourceKey : AnyObject ] {
942
- fatalError ( )
943
- }
944
-
945
- @available ( * , unavailable, message: " Use struct URLResourceValues and URL.setResourceValues(_:) instead " )
946
- public func getResourceValue( _ value: AutoreleasingUnsafeMutablePointer < AnyObject ? > , forKey key: URLResourceKey ) throws {
947
- fatalError ( )
948
- }
949
-
950
930
// MARK: - Bridging Support
951
931
952
932
/// We must not store an NSURL without running it through this function. This makes sure that we do not hold a file reference URL, which changes the nullability of many NSURL functions.
@@ -968,15 +948,15 @@ public struct URL : ReferenceConvertible, Equatable {
968
948
}
969
949
}
970
950
971
- extension URL : _ObjectiveCBridgeable {
951
+ extension URL {
972
952
@_semantics ( " convertToObjectiveC " )
973
953
public func _bridgeToObjectiveC( ) -> NSURL {
974
954
return _url
975
955
}
976
956
977
957
public static func _forceBridgeFromObjectiveC( _ source: NSURL , result: inout URL ? ) {
978
958
if !_conditionallyBridgeFromObjectiveC( source, result: & result) {
979
- fatalError ( " Unable to bridge \( _ObjectiveCType . self) to \( self ) " )
959
+ fatalError ( " Unable to bridge \( NSURL . self) to \( self ) " )
980
960
}
981
961
}
982
962
@@ -1002,14 +982,6 @@ extension URL : CustomStringConvertible, CustomDebugStringConvertible {
1002
982
}
1003
983
}
1004
984
1005
- extension NSURL : _HasCustomAnyHashableRepresentation {
1006
- // Must be @nonobjc to avoid infinite recursion during bridging.
1007
- @nonobjc
1008
- public func _toCustomAnyHashable( ) -> AnyHashable ? {
1009
- return AnyHashable ( self as URL )
1010
- }
1011
- }
1012
-
1013
985
extension URL : CustomPlaygroundQuickLookable {
1014
986
public var customPlaygroundQuickLook : PlaygroundQuickLook {
1015
987
return . url( absoluteString)
0 commit comments