-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Added URL API to Foundation.Process #1462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
87922c8
Added URL API to Foundation.Process
pvieito f18e193
Merge remote-tracking branch 'apple/master'
pvieito a984e11
Fixed Locale CF/Swift conversions
pvieito ac9f7af
Extended Locale tests
pvieito 57e8884
Added _CFLocaleCopyPreferredLanguagesFromPrefs to Linux
pvieito File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,11 +84,11 @@ open class NSLocale: NSObject, NSCopying, NSSecureCoding { | |
} | ||
|
||
extension NSLocale { | ||
open class var current: Locale { | ||
open static var current: Locale { | ||
return CFLocaleCopyCurrent()._swiftObject | ||
} | ||
|
||
open class var system: Locale { | ||
open static var system: Locale { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above for all |
||
return CFLocaleGetSystem()._swiftObject | ||
} | ||
} | ||
|
@@ -98,55 +98,55 @@ extension NSLocale { | |
return object(forKey: .identifier) as! String | ||
} | ||
|
||
open class var availableLocaleIdentifiers: [String] { | ||
open static var availableLocaleIdentifiers: [String] { | ||
var identifiers = Array<String>() | ||
for obj in CFLocaleCopyAvailableLocaleIdentifiers()._nsObject { | ||
identifiers.append(obj as! String) | ||
} | ||
return identifiers | ||
} | ||
|
||
open class var isoLanguageCodes: [String] { | ||
open static var isoLanguageCodes: [String] { | ||
var identifiers = Array<String>() | ||
for obj in CFLocaleCopyISOLanguageCodes()._nsObject { | ||
identifiers.append((obj as! NSString)._swiftObject) | ||
identifiers.append(obj as! String) | ||
} | ||
return identifiers | ||
} | ||
|
||
open class var isoCountryCodes: [String] { | ||
open static var isoCountryCodes: [String] { | ||
var identifiers = Array<String>() | ||
for obj in CFLocaleCopyISOCountryCodes()._nsObject { | ||
identifiers.append((obj as! NSString)._swiftObject) | ||
identifiers.append(obj as! String) | ||
} | ||
return identifiers | ||
} | ||
|
||
open class var isoCurrencyCodes: [String] { | ||
open static var isoCurrencyCodes: [String] { | ||
var identifiers = Array<String>() | ||
for obj in CFLocaleCopyISOCurrencyCodes()._nsObject { | ||
identifiers.append((obj as! NSString)._swiftObject) | ||
identifiers.append(obj as! String) | ||
} | ||
return identifiers | ||
} | ||
|
||
open class var commonISOCurrencyCodes: [String] { | ||
open static var commonISOCurrencyCodes: [String] { | ||
var identifiers = Array<String>() | ||
for obj in CFLocaleCopyCommonISOCurrencyCodes()._nsObject { | ||
identifiers.append((obj as! NSString)._swiftObject) | ||
identifiers.append(obj as! String) | ||
} | ||
return identifiers | ||
} | ||
|
||
open class var preferredLanguages: [String] { | ||
open static var preferredLanguages: [String] { | ||
var identifiers = Array<String>() | ||
for obj in CFLocaleCopyPreferredLanguages()._nsObject { | ||
identifiers.append((obj as! NSString)._swiftObject) | ||
identifiers.append(obj as! String) | ||
} | ||
return identifiers | ||
} | ||
|
||
open class func components(fromLocaleIdentifier string: String) -> [String : String] { | ||
open static func components(fromLocaleIdentifier string: String) -> [String : String] { | ||
var comps = Dictionary<String, String>() | ||
let values = CFLocaleCreateComponentsFromLocaleIdentifier(kCFAllocatorSystemDefault, string._cfObject)._nsObject | ||
values.enumerateKeysAndObjects(options: []) { (k, v, stop) in | ||
|
@@ -157,27 +157,27 @@ extension NSLocale { | |
return comps | ||
} | ||
|
||
open class func localeIdentifier(fromComponents dict: [String : String]) -> String { | ||
open static func localeIdentifier(fromComponents dict: [String : String]) -> String { | ||
return CFLocaleCreateLocaleIdentifierFromComponents(kCFAllocatorSystemDefault, dict._cfObject)._swiftObject | ||
} | ||
|
||
open class func canonicalLocaleIdentifier(from string: String) -> String { | ||
open static func canonicalLocaleIdentifier(from string: String) -> String { | ||
return CFLocaleCreateCanonicalLocaleIdentifierFromString(kCFAllocatorSystemDefault, string._cfObject)._swiftObject | ||
} | ||
|
||
open class func canonicalLanguageIdentifier(from string: String) -> String { | ||
open static func canonicalLanguageIdentifier(from string: String) -> String { | ||
return CFLocaleCreateCanonicalLanguageIdentifierFromString(kCFAllocatorSystemDefault, string._cfObject)._swiftObject | ||
} | ||
|
||
open class func localeIdentifier(fromWindowsLocaleCode lcid: UInt32) -> String? { | ||
open static func localeIdentifier(fromWindowsLocaleCode lcid: UInt32) -> String? { | ||
return CFLocaleCreateLocaleIdentifierFromWindowsLocaleCode(kCFAllocatorSystemDefault, lcid)._swiftObject | ||
} | ||
|
||
open class func windowsLocaleCode(fromLocaleIdentifier localeIdentifier: String) -> UInt32 { | ||
open static func windowsLocaleCode(fromLocaleIdentifier localeIdentifier: String) -> UInt32 { | ||
return CFLocaleGetWindowsLocaleCodeFromLocaleIdentifier(localeIdentifier._cfObject) | ||
} | ||
|
||
open class func characterDirection(forLanguage isoLangCode: String) -> NSLocale.LanguageDirection { | ||
open static func characterDirection(forLanguage isoLangCode: String) -> NSLocale.LanguageDirection { | ||
let dir = CFLocaleGetLanguageCharacterDirection(isoLangCode._cfObject) | ||
#if os(OSX) || os(iOS) | ||
return NSLocale.LanguageDirection(rawValue: UInt(dir.rawValue))! | ||
|
@@ -186,7 +186,7 @@ extension NSLocale { | |
#endif | ||
} | ||
|
||
open class func lineDirection(forLanguage isoLangCode: String) -> NSLocale.LanguageDirection { | ||
open static func lineDirection(forLanguage isoLangCode: String) -> NSLocale.LanguageDirection { | ||
let dir = CFLocaleGetLanguageLineDirection(isoLangCode._cfObject) | ||
#if os(OSX) || os(iOS) | ||
return NSLocale.LanguageDirection(rawValue: UInt(dir.rawValue))! | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why
static
? This doesn't match the Darwin signature: