Skip to content

Commit c6637cc

Browse files
committed
Split out NSDateComponents from NSCalendar.swift
- class NSDateComponents => NSDateComponents.swift
1 parent fbb3262 commit c6637cc

File tree

5 files changed

+649
-632
lines changed

5 files changed

+649
-632
lines changed

Foundation.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@
407407
B96C110025BA20A600985A32 /* NSURLQueryItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = B96C10FF25BA20A600985A32 /* NSURLQueryItem.swift */; };
408408
B96C110A25BA215800985A32 /* URLResourceKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = B96C110925BA215800985A32 /* URLResourceKey.swift */; };
409409
B96C112525BA2CE700985A32 /* URLQueryItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = B96C112425BA2CE700985A32 /* URLQueryItem.swift */; };
410+
B96C113725BA376D00985A32 /* NSDateComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = B96C113625BA376D00985A32 /* NSDateComponents.swift */; };
410411
B983E32C23F0C69600D9C402 /* Docs in Resources */ = {isa = PBXBuildFile; fileRef = B983E32B23F0C69600D9C402 /* Docs */; };
411412
B983E32E23F0C6E200D9C402 /* CONTRIBUTING.md in Resources */ = {isa = PBXBuildFile; fileRef = B983E32D23F0C6E200D9C402 /* CONTRIBUTING.md */; };
412413
B98E33DD2136AA740044EBE9 /* TestFileWithZeros.txt in Resources */ = {isa = PBXBuildFile; fileRef = B98E33DC2136AA740044EBE9 /* TestFileWithZeros.txt */; };
@@ -1116,6 +1117,7 @@
11161117
B96C10FF25BA20A600985A32 /* NSURLQueryItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSURLQueryItem.swift; sourceTree = "<group>"; };
11171118
B96C110925BA215800985A32 /* URLResourceKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLResourceKey.swift; sourceTree = "<group>"; };
11181119
B96C112425BA2CE700985A32 /* URLQueryItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLQueryItem.swift; sourceTree = "<group>"; };
1120+
B96C113625BA376D00985A32 /* NSDateComponents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSDateComponents.swift; sourceTree = "<group>"; };
11191121
B983E32B23F0C69600D9C402 /* Docs */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Docs; sourceTree = "<group>"; };
11201122
B983E32D23F0C6E200D9C402 /* CONTRIBUTING.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = CONTRIBUTING.md; sourceTree = "<group>"; };
11211123
B98E33DC2136AA740044EBE9 /* TestFileWithZeros.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TestFileWithZeros.txt; sourceTree = "<group>"; };
@@ -2103,6 +2105,7 @@
21032105
5BC1B9AB21F275D500524D8C /* NSData+DataProtocol.swift */,
21042106
5BDC3F331BCC5DCB00ED97BB /* NSData.swift */,
21052107
5BDC3F341BCC5DCB00ED97BB /* NSDate.swift */,
2108+
B96C113625BA376D00985A32 /* NSDateComponents.swift */,
21062109
EADE0B5A1BD15DFF00C49C64 /* NSDecimalNumber.swift */,
21072110
5BDC3F361BCC5DCB00ED97BB /* NSDictionary.swift */,
21082111
5BDC3F371BCC5DCB00ED97BB /* NSEnumerator.swift */,
@@ -2913,6 +2916,7 @@
29132916
EADE0BB51BD15E0000C49C64 /* Scanner.swift in Sources */,
29142917
EADE0BA01BD15DFF00C49C64 /* NSIndexPath.swift in Sources */,
29152918
5BF7AEB51BCD51F9008F214A /* NSPathUtilities.swift in Sources */,
2919+
B96C113725BA376D00985A32 /* NSDateComponents.swift in Sources */,
29162920
EADE0B9D1BD15DFF00C49C64 /* NSGeometry.swift in Sources */,
29172921
5BF7AEAA1BCD51F9008F214A /* DateFormatter.swift in Sources */,
29182922
5BECBA361D1CACC500B39B1F /* MeasurementFormatter.swift in Sources */,

Sources/Foundation/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ add_library(Foundation
6363
NSData+DataProtocol.swift
6464
NSData.swift
6565
NSDate.swift
66+
NSDateComponents.swift
6667
NSDecimalNumber.swift
6768
NSDictionary.swift
6869
NSEnumerator.swift

Sources/Foundation/DateComponents.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,3 +463,14 @@ extension DateComponents : Codable {
463463
try container.encodeIfPresent(self.yearForWeekOfYear, forKey: .yearForWeekOfYear)
464464
}
465465
}
466+
467+
extension DateComponents : _NSBridgeable {
468+
typealias NSType = NSDateComponents
469+
var _nsObject: NSType { return _bridgeToObjectiveC() }
470+
}
471+
472+
extension DateComponents {
473+
func _createCFDateComponents() -> CFDateComponents {
474+
return _nsObject._createCFDateComponents()
475+
}
476+
}

0 commit comments

Comments
 (0)