Skip to content

Commit 33419c8

Browse files
committed
Merge remote-tracking branch 'origin/master' into swift-4.0-branch
2 parents 3a857e0 + bcd35c6 commit 33419c8

File tree

91 files changed

+634
-635
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+634
-635
lines changed

Foundation.xcodeproj/project.pbxproj

+245-245
Large diffs are not rendered by default.
File renamed without changes.

Foundation/ByteCountFormatter.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ open class ByteCountFormatter : Formatter {
5050
NSUnimplemented()
5151
}
5252

53-
/* Specify the units that can be used in the output. If NSByteCountFormatterUseDefault, uses platform-appropriate settings; otherwise will only use the specified units. This is the default value. Note that ZB and YB cannot be covered by the range of possible values, but you can still choose to use these units to get fractional display ("0.0035 ZB" for instance).
53+
/* Specify the units that can be used in the output. If ByteCountFormatter.Units.useDefault, uses platform-appropriate settings; otherwise will only use the specified units. This is the default value. Note that ZB and YB cannot be covered by the range of possible values, but you can still choose to use these units to get fractional display ("0.0035 ZB" for instance).
5454
*/
5555
open var allowedUnits: Units = .useDefault
5656

57-
/* Specify how the count is displayed by indicating the number of bytes to be used for kilobyte. The default setting is NSByteCountFormatterFileCount, which is the system specific value for file and storage sizes.
57+
/* Specify how the count is displayed by indicating the number of bytes to be used for kilobyte. The default setting is ByteCountFormatter.CountStyle.fileCount, which is the system specific value for file and storage sizes.
5858
*/
5959
open var countStyle: CountStyle = .file
6060

61-
/* Choose whether to allow more natural display of some values, such as zero, where it may be displayed as "Zero KB," ignoring all other flags or options (with the exception of NSByteCountFormatterUseBytes, which would generate "Zero bytes"). The result is appropriate for standalone output. Default value is YES. Special handling of certain values such as zero is especially important in some languages, so it's highly recommended that this property be left in its default state.
61+
/* Choose whether to allow more natural display of some values, such as zero, where it may be displayed as "Zero KB," ignoring all other flags or options (with the exception of ByteCountFormatter.Units.useBytes, which would generate "Zero bytes"). The result is appropriate for standalone output. Default value is YES. Special handling of certain values such as zero is especially important in some languages, so it's highly recommended that this property be left in its default state.
6262
*/
6363
open var allowsNonnumericFormatting: Bool = true
6464

@@ -91,7 +91,7 @@ open class ByteCountFormatter : Formatter {
9191
*/
9292
private let numberFormatter = NumberFormatter()
9393

94-
/* Shortcut for converting a byte count into a string without creating an NSByteCountFormatter and an NSNumber. If you need to specify options other than countStyle, create an instance of NSByteCountFormatter first.
94+
/* Shortcut for converting a byte count into a string without creating an ByteCountFormatter and an NSNumber. If you need to specify options other than countStyle, create an instance of ByteCountFormatter first.
9595
*/
9696
open class func string(fromByteCount byteCount: Int64, countStyle: ByteCountFormatter.CountStyle) -> String {
9797
let formatter = ByteCountFormatter()

Foundation/DateComponentsFormatter.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extension DateComponentsFormatter {
3434
}
3535
}
3636

37-
/* NSDateComponentsFormatter provides locale-correct and flexible string formatting of quantities of time, such as "1 day" or "1h 10m", as specified by NSDateComponents. For formatting intervals of time (such as "2PM to 5PM"), see NSDateIntervalFormatter. NSDateComponentsFormatter is thread-safe, in that calling methods on it from multiple threads will not cause crashes or incorrect results, but it makes no attempt to prevent confusion when one thread sets something and another thread isn't expecting it to change.
37+
/* DateComponentsFormatter provides locale-correct and flexible string formatting of quantities of time, such as "1 day" or "1h 10m", as specified by NSDateComponents. For formatting intervals of time (such as "2PM to 5PM"), see DateIntervalFormatter. DateComponentsFormatter is thread-safe, in that calling methods on it from multiple threads will not cause crashes or incorrect results, but it makes no attempt to prevent confusion when one thread sets something and another thread isn't expecting it to change.
3838
*/
3939

4040
open class DateComponentsFormatter : Formatter {
@@ -53,11 +53,11 @@ open class DateComponentsFormatter : Formatter {
5353

5454
open func string(from components: DateComponents) -> String? { NSUnimplemented() }
5555

56-
/* Normally, NSDateComponentsFormatter will calculate as though counting from the current date and time (e.g. in February, 1 month formatted as a number of days will be 28). -stringFromDate:toDate: calculates from the passed-in startDate instead.
56+
/* Normally, DateComponentsFormatter will calculate as though counting from the current date and time (e.g. in February, 1 month formatted as a number of days will be 28). -stringFromDate:toDate: calculates from the passed-in startDate instead.
5757

5858
See 'allowedUnits' for how the default set of allowed units differs from -stringFromDateComponents:.
5959

60-
Note that this is still formatting the quantity of time between the dates, not the pair of dates itself. For strings like "Feb 22nd - Feb 28th", use NSDateIntervalFormatter.
60+
Note that this is still formatting the quantity of time between the dates, not the pair of dates itself. For strings like "Feb 22nd - Feb 28th", use DateIntervalFormatter.
6161
*/
6262
open func string(from startDate: Date, to endDate: Date) -> String? { NSUnimplemented() }
6363

@@ -67,7 +67,7 @@ open class DateComponentsFormatter : Formatter {
6767

6868
open class func localizedString(from components: DateComponents, unitsStyle: UnitsStyle) -> String? { NSUnimplemented() }
6969

70-
/* Choose how to indicate units. For example, 1h 10m vs 1:10. Default is NSDateComponentsFormatterUnitsStylePositional.
70+
/* Choose how to indicate units. For example, 1h 10m vs 1:10. Default is DateComponentsFormatter.UnitsStyle.positional.
7171
*/
7272
open var unitsStyle: UnitsStyle
7373

@@ -87,9 +87,9 @@ open class DateComponentsFormatter : Formatter {
8787
*/
8888
open var allowedUnits: NSCalendar.Unit
8989

90-
/* Bitmask specifying how to handle zeros in units. This includes both padding and dropping zeros so that a consistent number digits are displayed, causing updating displays to remain more stable. Default is NSDateComponentsFormatterZeroFormattingBehaviorDefault.
90+
/* Bitmask specifying how to handle zeros in units. This includes both padding and dropping zeros so that a consistent number digits are displayed, causing updating displays to remain more stable. Default is DateComponentsFormatter.ZeroFormattingBehavior.default.
9191

92-
If the combination of zero formatting behavior and style would lead to ambiguous date formats (for example, 1:10 meaning 1 hour, 10 seconds), NSDateComponentsFormatter will throw an exception.
92+
If the combination of zero formatting behavior and style would lead to ambiguous date formats (for example, 1:10 meaning 1 hour, 10 seconds), DateComponentsFormatter will throw an exception.
9393
*/
9494
open var zeroFormattingBehavior: ZeroFormattingBehavior
9595

@@ -129,7 +129,7 @@ open class DateComponentsFormatter : Formatter {
129129
*/
130130
open var formattingContext: Context
131131

132-
/* NSDateComponentsFormatter currently only implements formatting, not parsing. Until it implements parsing, this will always return NO.
132+
/* DateComponentsFormatter currently only implements formatting, not parsing. Until it implements parsing, this will always return NO.
133133
*/
134134
/// - Experiment: This is a draft API currently under consideration for official import into Foundation as a suitable alternative
135135
/// - Note: Since this API is under consideration it may be either removed or revised in the near future

Foundation/DateIntervalFormatter.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ extension DateIntervalFormatter {
1919
}
2020
}
2121

22-
// NSDateIntervalFormatter is used to format the range between two NSDates in a locale-sensitive way.
23-
// NSDateIntervalFormatter returns nil and NO for all methods in NSFormatter.
22+
// DateIntervalFormatter is used to format the range between two NSDates in a locale-sensitive way.
23+
// DateIntervalFormatter returns nil and NO for all methods in Formatter.
2424

2525
open class DateIntervalFormatter : Formatter {
2626

@@ -36,8 +36,8 @@ open class DateIntervalFormatter : Formatter {
3636
/*@NSCopying*/ open var calendar: Calendar! // default is the calendar of the locale
3737
/*@NSCopying*/ open var timeZone: TimeZone! // default is [NSTimeZone defaultTimeZone]
3838
open var dateTemplate: String! // default is an empty string
39-
open var dateStyle: Style // default is NSDateIntervalFormatterNoStyle
40-
open var timeStyle: Style // default is NSDateIntervalFormatterNoStyle
39+
open var dateStyle: Style // default is .noStyle
40+
open var timeStyle: Style // default is .noStyle
4141

4242
/*
4343
If the range smaller than the resolution specified by the dateTemplate, a single date format will be produced. If the range is larger than the format specified by the dateTemplate, a locale-specific fallback will be used to format the items missing from the pattern.

Foundation/NSDecimal.swift Foundation/Decimal.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -1929,7 +1929,7 @@ fileprivate let pow10 = [
19291929
/*^39 is on 9 shorts. */
19301930
]
19311931

1932-
// Copied from NSScanner.swift
1932+
// Copied from Scanner.swift
19331933
private func decimalSep(_ locale: Locale?) -> String {
19341934
if let loc = locale {
19351935
if let sep = loc._bridgeToObjectiveC().object(forKey: .decimalSeparator) as? NSString {
@@ -1941,15 +1941,15 @@ private func decimalSep(_ locale: Locale?) -> String {
19411941
}
19421942
}
19431943

1944-
// Copied from NSScanner.swift
1944+
// Copied from Scanner.swift
19451945
private func isADigit(_ ch: unichar) -> Bool {
19461946
struct Local {
19471947
static let set = CharacterSet.decimalDigits
19481948
}
19491949
return Local.set.contains(UnicodeScalar(ch)!)
19501950
}
19511951

1952-
// Copied from NSScanner.swift
1952+
// Copied from Scanner.swift
19531953
private func numericValue(_ ch: unichar) -> Int {
19541954
if (ch >= unichar(unicodeScalarLiteral: "0") && ch <= unichar(unicodeScalarLiteral: "9")) {
19551955
return Int(ch) - Int(unichar(unicodeScalarLiteral: "0"))

Foundation/EnergyFormatter.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ open class EnergyFormatter: Formatter {
7878
super.init()
7979
}
8080

81-
/*@NSCopying*/ open var numberFormatter: NumberFormatter! // default is NSNumberFormatter with NSNumberFormatterDecimalStyle
81+
/*@NSCopying*/ open var numberFormatter: NumberFormatter! // default is NumberFormatter with NumberFormatter.Style.decimal
8282
open var unitStyle: UnitStyle // default is NSFormattingUnitStyleMedium
83-
open var isForFoodEnergyUse: Bool // default is NO; if it is set to YES, NSEnergyFormatterUnitKilocalorie may be “C” instead of “kcal"
83+
open var isForFoodEnergyUse: Bool // default is NO; if it is set to YES, EnergyFormatter.Unit.kilocalorie may be “C” instead of “kcal"
8484

8585
// Format a combination of a number and an unit to a localized string.
8686
open func string(fromValue value: Double, unit: Unit) -> String {

Foundation/FileManager.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ open class FileManager : NSObject {
111111
try self.createSymbolicLink(atPath: url.path, withDestinationPath: destURL.path)
112112
}
113113

114-
/* Instances of NSFileManager may now have delegates. Each instance has one delegate, and the delegate is not retained. In versions of Mac OS X prior to 10.5, the behavior of calling [[NSFileManager alloc] init] was undefined. In Mac OS X 10.5 "Leopard" and later, calling [[NSFileManager alloc] init] returns a new instance of an NSFileManager.
114+
/* Instances of FileManager may now have delegates. Each instance has one delegate, and the delegate is not retained. In versions of Mac OS X prior to 10.5, the behavior of calling [[NSFileManager alloc] init] was undefined. In Mac OS X 10.5 "Leopard" and later, calling [[NSFileManager alloc] init] returns a new instance of an FileManager.
115115
*/
116116
open weak var delegate: FileManagerDelegate? {
117117
NSUnimplemented()
@@ -505,7 +505,7 @@ open class FileManager : NSObject {
505505
try self.removeItem(atPath: url.path)
506506
}
507507

508-
/* Process working directory management. Despite the fact that these are instance methods on NSFileManager, these methods report and change (respectively) the working directory for the entire process. Developers are cautioned that doing so is fraught with peril.
508+
/* Process working directory management. Despite the fact that these are instance methods on FileManager, these methods report and change (respectively) the working directory for the entire process. Developers are cautioned that doing so is fraught with peril.
509509
*/
510510
open var currentDirectoryPath: String {
511511
let length = Int(PATH_MAX) + 1
@@ -856,7 +856,7 @@ public protocol FileManagerDelegate : NSObjectProtocol {
856856
func fileManager(_ fileManager: FileManager, shouldCopyItemAtPath srcPath: String, toPath dstPath: String) -> Bool
857857
func fileManager(_ fileManager: FileManager, shouldCopyItemAt srcURL: URL, to dstURL: URL) -> Bool
858858

859-
/* fileManager:shouldProceedAfterError:copyingItemAtPath:toPath: gives the delegate an opportunity to recover from or continue copying after an error. If an error occurs, the error object will contain an NSError indicating the problem. The source path and destination paths are also provided. If this method returns YES, the NSFileManager instance will continue as if the error had not occurred. If this method returns NO, the NSFileManager instance will stop copying, return NO from copyItemAtPath:toPath:error: and the error will be provied there.
859+
/* fileManager:shouldProceedAfterError:copyingItemAtPath:toPath: gives the delegate an opportunity to recover from or continue copying after an error. If an error occurs, the error object will contain an NSError indicating the problem. The source path and destination paths are also provided. If this method returns YES, the FileManager instance will continue as if the error had not occurred. If this method returns NO, the FileManager instance will stop copying, return NO from copyItemAtPath:toPath:error: and the error will be provied there.
860860
*/
861861
func fileManager(_ fileManager: FileManager, shouldProceedAfterError error: Error, copyingItemAtPath srcPath: String, toPath dstPath: String) -> Bool
862862
func fileManager(_ fileManager: FileManager, shouldProceedAfterError error: Error, copyingItemAt srcURL: URL, to dstURL: URL) -> Bool
@@ -882,7 +882,7 @@ public protocol FileManagerDelegate : NSObjectProtocol {
882882
func fileManager(_ fileManager: FileManager, shouldProceedAfterError error: Error, linkingItemAtPath srcPath: String, toPath dstPath: String) -> Bool
883883
func fileManager(_ fileManager: FileManager, shouldProceedAfterError error: Error, linkingItemAt srcURL: URL, to dstURL: URL) -> Bool
884884

885-
/* fileManager:shouldRemoveItemAtPath: allows the delegate the opportunity to not remove the item at path. If the delegate returns YES from this method, the NSFileManager instance will attempt to remove the item. If the delegate returns NO from this method, the remove skips the item. If the item is a directory, no children of that item will be visited.
885+
/* fileManager:shouldRemoveItemAtPath: allows the delegate the opportunity to not remove the item at path. If the delegate returns YES from this method, the FileManager instance will attempt to remove the item. If the delegate returns NO from this method, the remove skips the item. If the item is a directory, no children of that item will be visited.
886886
*/
887887
func fileManager(_ fileManager: FileManager, shouldRemoveItemAtPath path: String) -> Bool
888888
func fileManager(_ fileManager: FileManager, shouldRemoveItemAt URL: URL) -> Bool

Foundation/NSHTTPCookie.swift Foundation/HTTPCookie.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ extension HTTPCookiePropertyKey {
7171
internal static let created = HTTPCookiePropertyKey(rawValue: "Created")
7272
}
7373

74-
/// `NSHTTPCookie` represents an http cookie.
74+
/// `HTTPCookie` represents an http cookie.
7575
///
76-
/// An `NSHTTPCookie` instance represents a single http cookie. It is
76+
/// An `HTTPCookie` instance represents a single http cookie. It is
7777
/// an immutable object initialized from a dictionary that contains
7878
/// the various cookie attributes. It has accessors to get the various
7979
/// attributes of a cookie.
@@ -98,7 +98,7 @@ open class HTTPCookie : NSObject {
9898
.path, .secure, .expires, .comment, .commentURL,
9999
.discard, .maximumAge, .port]
100100

101-
/// Initialize a NSHTTPCookie object with a dictionary of parameters
101+
/// Initialize a HTTPCookie object with a dictionary of parameters
102102
///
103103
/// - Parameter properties: The dictionary of properties to be used to
104104
/// initialize this cookie.
@@ -216,7 +216,7 @@ open class HTTPCookie : NSObject {
216216
///
217217
/// All other keys are ignored.
218218
///
219-
/// - Returns: An initialized `NSHTTPCookie`, or nil if the set of
219+
/// - Returns: An initialized `HTTPCookie`, or nil if the set of
220220
/// dictionary keys is invalid, for example because a required key is
221221
/// missing, or a recognized key maps to an illegal value.
222222
///
@@ -373,7 +373,7 @@ open class HTTPCookie : NSObject {
373373
/// you can pass a dictionary containing data other than cookie data.
374374
/// - Parameter headerFields: The response header fields to check for cookies.
375375
/// - Parameter URL: The URL that the cookies came from - relevant to how the cookies are interpeted.
376-
/// - Returns: An array of NSHTTPCookie objects
376+
/// - Returns: An array of HTTPCookie objects
377377
open class func cookies(withResponseHeaderFields headerFields: [String : String], for URL: URL) -> [HTTPCookie] {
378378

379379
//HTTP Cookie parsing based on RFC 6265: https://tools.ietf.org/html/rfc6265
@@ -469,10 +469,10 @@ open class HTTPCookie : NSObject {
469469
/// Returns a dictionary representation of the receiver.
470470
///
471471
/// This method returns a dictionary representation of the
472-
/// `NSHTTPCookie` which can be saved and passed to
472+
/// `HTTPCookie` which can be saved and passed to
473473
/// `init(properties:)` later to reconstitute an equivalent cookie.
474474
///
475-
/// See the `NSHTTPCookie` `init(properties:)` method for
475+
/// See the `HTTPCookie` `init(properties:)` method for
476476
/// more information on the constraints imposed on the dictionary, and
477477
/// for descriptions of the supported keys and values.
478478
///

0 commit comments

Comments
 (0)