|
13 | 13 | @_exported import Foundation // Clang module
|
14 | 14 | import CoreFoundation
|
15 | 15 | import _SwiftCoreFoundationOverlayShims
|
| 16 | +import _SwiftFoundationOverlayShims |
16 | 17 |
|
17 | 18 | private func _utfRangeToCFRange(_ inRange : Range<Unicode.Scalar>) -> CFRange {
|
18 | 19 | return CFRange(
|
@@ -513,35 +514,59 @@ public struct CharacterSet : ReferenceConvertible, Equatable, Hashable, SetAlgeb
|
513 | 514 | }
|
514 | 515 |
|
515 | 516 | // MARK: Static functions, from NSURL
|
516 |
| - |
| 517 | + |
517 | 518 | /// Returns the character set for characters allowed in a user URL subcomponent.
|
518 | 519 | public static var urlUserAllowed : CharacterSet {
|
519 |
| - return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLUserAllowedCharacterSet() as NSCharacterSet) |
| 520 | + if #available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) { |
| 521 | + return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLUserAllowedCharacterSet() as NSCharacterSet) |
| 522 | + } else { |
| 523 | + return CharacterSet(_uncopiedImmutableReference: _NSURLComponentsGetURLUserAllowedCharacterSet() as! NSCharacterSet) |
| 524 | + } |
520 | 525 | }
|
521 | 526 |
|
522 | 527 | /// Returns the character set for characters allowed in a password URL subcomponent.
|
523 | 528 | public static var urlPasswordAllowed : CharacterSet {
|
524 |
| - return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLPasswordAllowedCharacterSet() as NSCharacterSet) |
| 529 | + if #available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) { |
| 530 | + return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLPasswordAllowedCharacterSet() as NSCharacterSet) |
| 531 | + } else { |
| 532 | + return CharacterSet(_uncopiedImmutableReference: _NSURLComponentsGetURLPasswordAllowedCharacterSet() as! NSCharacterSet) |
| 533 | + } |
525 | 534 | }
|
526 | 535 |
|
527 | 536 | /// Returns the character set for characters allowed in a host URL subcomponent.
|
528 | 537 | public static var urlHostAllowed : CharacterSet {
|
529 |
| - return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLHostAllowedCharacterSet() as NSCharacterSet) |
| 538 | + if #available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) { |
| 539 | + return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLHostAllowedCharacterSet() as NSCharacterSet) |
| 540 | + } else { |
| 541 | + return CharacterSet(_uncopiedImmutableReference: _NSURLComponentsGetURLHostAllowedCharacterSet() as! NSCharacterSet) |
| 542 | + } |
530 | 543 | }
|
531 | 544 |
|
532 | 545 | /// Returns the character set for characters allowed in a path URL component.
|
533 | 546 | public static var urlPathAllowed : CharacterSet {
|
534 |
| - return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLPathAllowedCharacterSet() as NSCharacterSet) |
| 547 | + if #available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) { |
| 548 | + return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLPathAllowedCharacterSet() as NSCharacterSet) |
| 549 | + } else { |
| 550 | + return CharacterSet(_uncopiedImmutableReference: _NSURLComponentsGetURLPathAllowedCharacterSet() as! NSCharacterSet) |
| 551 | + } |
535 | 552 | }
|
536 | 553 |
|
537 | 554 | /// Returns the character set for characters allowed in a query URL component.
|
538 | 555 | public static var urlQueryAllowed : CharacterSet {
|
539 |
| - return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLQueryAllowedCharacterSet() as NSCharacterSet) |
| 556 | + if #available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) { |
| 557 | + return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLQueryAllowedCharacterSet() as NSCharacterSet) |
| 558 | + } else { |
| 559 | + return CharacterSet(_uncopiedImmutableReference: _NSURLComponentsGetURLQueryAllowedCharacterSet() as! NSCharacterSet) |
| 560 | + } |
540 | 561 | }
|
541 | 562 |
|
542 | 563 | /// Returns the character set for characters allowed in a fragment URL component.
|
543 | 564 | public static var urlFragmentAllowed : CharacterSet {
|
544 |
| - return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLFragmentAllowedCharacterSet() as NSCharacterSet) |
| 565 | + if #available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) { |
| 566 | + return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLFragmentAllowedCharacterSet() as NSCharacterSet) |
| 567 | + } else { |
| 568 | + return CharacterSet(_uncopiedImmutableReference: _NSURLComponentsGetURLFragmentAllowedCharacterSet() as! NSCharacterSet) |
| 569 | + } |
545 | 570 | }
|
546 | 571 |
|
547 | 572 | // MARK: Immutable functions
|
|
0 commit comments