Skip to content

Commit 4df89e5

Browse files
committed
# This is a combination of 37 commits.
# The first commit's message is: Implemented Comparable on, and added initializer to, NSOperatingSystemVersion # This is the 2nd commit message: Use implicit getters for read-only properties # This is the 3rd commit message: Use implicit getters for read-only properties in NSString.swift # This is the 4th commit message: Use implicit getters for read-only properties in NSArray.swift # This is the 5th commit message: Use implicit getters for read-only properties in NSCalendar.swift # This is the 6th commit message: Use implicit getters for read-only properties in NSCharacterSet.swift # This is the 7th commit message: Use implicit getters for read-only properties in NSData.swift # This is the 8th commit message: Use implicit getters for read-only properties in NSDictionary.swift # This is the 9th commit message: Use implicit getters for read-only properties in NSSet.swift # This is the 10th commit message: Use implicit getters for read-only properties in NSNumber.swift # This is the 11th commit message: Use implicit getters for read-only properties in NSNumberFormatter.swift # This is the 12th commit message: Use implicit getters for read-only properties in NSNotification.swift # This is the 13th commit message: Use implicit getters for read-only properties in NSLock.swift # This is the 14th commit message: Use implicit getters for read-only properties in NSKeyedArchiver.swift # This is the 15th commit message: Use implicit getters for read-only properties in NSCoder.swift # This is the 16th commit message: Use implicit getters for read-only properties in NSCFArray.swift # This is the 17th commit message: Use implicit getters for read-only properties in NSCFString.swift # This is the 18th commit message: Use implicit getters for read-only properties in NSError.swift # This is the 19th commit message: Use implicit getters for read-only properties in NSHost.swift # This is the 20th commit message: Use implicit getters for read-only properties in NSObject.swift # This is the 21st commit message: Use implicit getters for read-only properties in NSProcessInfo.swift # This is the 22nd commit message: Use implicit getters for read-only properties in NSScanner.swift # This is the 23rd commit message: e implicit getters for read-only properties in NSSwiftRuntime.swift # This is the 24th commit message: Use implicit getters for read-only properties in NSThread.swift # This is the 25th commit message: Use implicit getters for read-only properties in NSTimer.swift # This is the 26th commit message: Use implicit getters for read-only properties in NSTimeZone.swift # This is the 27th commit message: Use implicit getters for read-only properties in NSURL.swift # This is the 28th commit message: Use implicit getters for read-only properties in NSURLRequest.swift # This is the 29th commit message: Use implicit getters for read-only properties in NSUUID.swift # This is the 30th commit message: Use implicit getters for read-only properties in NSXMLDocument.swift # This is the 31st commit message: Use implicit getters for read-only properties in NSXMLDTDNode.swift # This is the 32nd commit message: Use implicit getters for read-only properties in TestNSURL.swift # This is the 33rd commit message: Disable NSThread tests due to CI timeout failures # This is the 34th commit message: [SR-377] NSGetSizeAndAlignment() implementation An implementation of NSGetSizeAndAlignment(), along with the ObjCType definitions, is necessary for implementing NSKeyedArchiver. # This is the 35th commit message: [SR-377] Implement NSClassFromString() An implementation of NSClassFromString() is necessary to implement NSKeyedArchiver. This requires a version of stdlib that supports _typeByName() and a compiler that can emit type metadata records. # This is the 36th commit message: [SR-377] Implement NSConcreteValue class The NSConcreteValue class is a wrapper for arbitrary values that can be described using Objective-C type notation. Note that owing to the lack of factory initializers, a rather ugly workaround is used to make NSValue behave as a class cluster. This should not have a performance impact in practice as its init() is a NOOP and most NSValues will be NSNumbers. NSConcreteValue does not yet support "special" values such as NSRects; these are in a separate commit. # This is the 37th commit message: [SR-377] make internal property list APIs available to Foundation NSKeyedArchiver requires the ability to construct CFKeyedArchiverUID instances and also access to other (otherwise private) property list APIs in CF.
1 parent e8716cf commit 4df89e5

Some content is hidden

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

41 files changed

+939
-698
lines changed

CoreFoundation/Base.subproj/CFRuntime.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ void __CFInitialize(void) {
11351135
#if (DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_EMBEDDED_MINI) && !DEPLOYMENT_RUNTIME_SWIFT
11361136
CFMachPortGetTypeID();
11371137
#endif
1138-
#if (DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_WINDOWS) && !DEPLOYMENT_RUNTIME_SWIFT
1138+
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX
11391139
__CFStreamInitialize();
11401140
#endif
11411141
#if DEPLOYMENT_TARGET_WINDOWS
@@ -1159,6 +1159,7 @@ void __CFInitialize(void) {
11591159
#endif
11601160
#endif
11611161
#if DEPLOYMENT_RUNTIME_SWIFT
1162+
_CFKeyedArchiverUIDGetTypeID();
11621163
#ifndef __CFInitializeSwift
11631164
#if TARGET_OS_LINUX
11641165
#define __CFInitializeSwift _TF10Foundation19__CFInitializeSwiftFT_T_

CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,16 @@ CF_PRIVATE CF_EXPORT void _cf_uuid_unparse_upper(const _cf_uuid_t uu, _cf_uuid_s
224224

225225

226226
CF_PRIVATE CF_EXPORT int32_t _CF_SOCK_STREAM();
227+
extern CFWriteStreamRef _CFWriteStreamCreateFromFileDescriptor(CFAllocatorRef alloc, int fd);
228+
#if !__COREFOUNDATION_FORFOUNDATIONONLY__
229+
typedef const struct __CFKeyedArchiverUID * CFKeyedArchiverUIDRef;
230+
extern CFTypeID _CFKeyedArchiverUIDGetTypeID(void);
231+
extern CFKeyedArchiverUIDRef _CFKeyedArchiverUIDCreate(CFAllocatorRef allocator, uint32_t value);
232+
extern uint32_t _CFKeyedArchiverUIDGetValue(CFKeyedArchiverUIDRef uid);
233+
#endif
234+
235+
extern CFIndex __CFBinaryPlistWriteToStream(CFPropertyListRef plist, CFTypeRef stream);
236+
extern CFDataRef _CFPropertyListCreateXMLDataWithExtras(CFAllocatorRef allocator, CFPropertyListRef propertyList);
227237

228238
CF_PRIVATE CF_EXPORT char *_Nonnull*_Nonnull _CFEnviron(void);
229239

CoreFoundation/Parsing.subproj/CFBinaryPList.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include <limits.h>
3131
#include <string.h>
3232
#include "CFInternal.h"
33-
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_WINDOWS
33+
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX
3434
#include <CoreFoundation/CFStream.h>
3535
#endif
3636

@@ -166,7 +166,7 @@ static void writeBytes(__CFBinaryPlistWriteBuffer *buf, const UInt8 *bytes, CFIn
166166
if (buf->stream && !dryRun) CFDataAppendBytes((CFMutableDataRef)buf->stream, bytes, length);
167167
buf->written += length;
168168
} else {
169-
#if (DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_WINDOWS) && !DEPLOYMENT_RUNTIME_SWIFT
169+
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX
170170
while (0 < length) {
171171
CFIndex ret = (buf->stream && !dryRun) ? CFWriteStreamWrite((CFWriteStreamRef)buf->stream, bytes, length) : length;
172172
if (ret == 0) {

CoreFoundation/Parsing.subproj/CFPropertyList.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "CFInternal.h"
2626
#include <CoreFoundation/CFBurstTrie.h>
2727
#include <CoreFoundation/CFString.h>
28-
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_WINDOWS
28+
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX
2929
#include <CoreFoundation/CFStream.h>
3030
#endif
3131
#include <CoreFoundation/CFCalendar.h>
@@ -101,6 +101,7 @@ CF_EXPORT CFNumberType _CFNumberGetType2(CFNumberRef number);
101101

102102
static CFTypeID stringtype, datatype, numbertype, datetype;
103103
static CFTypeID booltype, nulltype, dicttype, arraytype, settype;
104+
static CFTypeID uidtype; /* for debugging */
104105

105106
static void initStatics() {
106107
static dispatch_once_t once = 0;
@@ -114,6 +115,7 @@ static void initStatics() {
114115
arraytype = CFArrayGetTypeID();
115116
settype = CFSetGetTypeID();
116117
nulltype = CFNullGetTypeID();
118+
uidtype = _CFKeyedArchiverUIDGetTypeID();
117119
});
118120
}
119121

@@ -663,6 +665,14 @@ if (date.year != y || date.month != M || date.day != d || date.hour != H || date
663665
_plistAppendCharacters(xmlString, CFXMLPlistTagsUnicode[FALSE_IX], FALSE_TAG_LENGTH);
664666
_plistAppendUTF8CString(xmlString, "/>\n");
665667
}
668+
} else if (typeID == uidtype) {
669+
CFStringRef key = CFSTR("CF$UID");
670+
CFIndex n = _CFKeyedArchiverUIDGetValue((CFKeyedArchiverUIDRef)object);
671+
CFNumberRef value = CFNumberCreate(kCFAllocatorSystemDefault, kCFNumberCFIndexType, &n);
672+
CFDictionaryRef dict = CFDictionaryCreate(kCFAllocatorSystemDefault, (const void **)(&key), (const void **)(&value), 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
673+
_CFAppendXML0(dict, indentation, xmlString);
674+
CFRelease(value);
675+
CFRelease(dict);
666676
}
667677
}
668678

@@ -2794,7 +2804,7 @@ CFDataRef CFPropertyListCreateData(CFAllocatorRef allocator, CFPropertyListRef p
27942804
} else if (format == kCFPropertyListXMLFormat_v1_0) {
27952805
data = _CFPropertyListCreateXMLData(allocator, propertyList, true);
27962806
} else if (format == kCFPropertyListBinaryFormat_v1_0) {
2797-
#if (DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_WINDOWS) && !DEPLOYMENT_RUNTIME_SWIFT
2807+
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX
27982808
// TODO: Is it more efficient to create a stream here or just use a mutable data?
27992809
CFWriteStreamRef stream = CFWriteStreamCreateWithAllocatedBuffers(kCFAllocatorSystemDefault, allocator);
28002810
CFWriteStreamOpen(stream);
@@ -2816,7 +2826,7 @@ CFDataRef CFPropertyListCreateData(CFAllocatorRef allocator, CFPropertyListRef p
28162826
return data;
28172827
}
28182828

2819-
#if (DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_WINDOWS) && !DEPLOYMENT_RUNTIME_SWIFT
2829+
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX
28202830

28212831
CFIndex CFPropertyListWrite(CFPropertyListRef propertyList, CFWriteStreamRef stream, CFPropertyListFormat format, CFOptionFlags options, CFErrorRef *error) {
28222832
initStatics();
@@ -3011,7 +3021,7 @@ CFPropertyListRef CFPropertyListCreateFromStream(CFAllocatorRef allocator, CFRea
30113021
return result;
30123022
}
30133023

3014-
#endif //(DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_WINDOWS) && !DEPLOYMENT_RUNTIME_SWIFT
3024+
#endif //(DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX)
30153025

30163026
#pragma mark -
30173027
#pragma mark Property List Copies

CoreFoundation/Parsing.subproj/CFPropertyList.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
#include <CoreFoundation/CFData.h>
2020
#include <CoreFoundation/CFString.h>
2121
#include <CoreFoundation/CFError.h>
22-
#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_EMBEDDED
2322
#include <CoreFoundation/CFStream.h>
24-
#endif
2523

2624
CF_IMPLICIT_BRIDGING_ENABLED
2725
CF_EXTERN_C_BEGIN
@@ -87,7 +85,6 @@ typedef CF_ENUM(CFIndex, CFPropertyListFormat) {
8785
CF_EXPORT
8886
Boolean CFPropertyListIsValid(CFPropertyListRef plist, CFPropertyListFormat format);
8987

90-
#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_EMBEDDED
9188
CF_IMPLICIT_BRIDGING_DISABLED
9289

9390
/* Writes the bytes of a plist serialization out to the stream. The
@@ -119,7 +116,6 @@ CF_EXPORT
119116
CFPropertyListRef CFPropertyListCreateFromStream(CFAllocatorRef allocator, CFReadStreamRef stream, CFIndex streamLength, CFOptionFlags mutabilityOption, CFPropertyListFormat *format, CFStringRef *errorString) CF_DEPRECATED(10_2, 10_10, 2_0, 8_0, "Use CFPropertyListCreateWithStream instead.");
120117

121118
CF_IMPLICIT_BRIDGING_ENABLED
122-
#endif
123119

124120
CF_ENUM(CFIndex) {
125121
kCFPropertyListReadCorruptError = 3840, // Error parsing a property list
@@ -133,8 +129,6 @@ CF_ENUM(CFIndex) {
133129
CF_EXPORT
134130
CFPropertyListRef CFPropertyListCreateWithData(CFAllocatorRef allocator, CFDataRef data, CFOptionFlags options, CFPropertyListFormat *format, CFErrorRef *error) CF_AVAILABLE(10_6, 4_0);
135131

136-
#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_EMBEDDED
137-
138132
/* Create and return a property list with a CFReadStream input. If the format parameter is non-NULL, it will be set to the format of the data after parsing is complete. The options parameter is used to specify CFPropertyListMutabilityOptions. The streamLength parameter specifies the number of bytes to read from the stream. Set streamLength to 0 to read until the end of the stream is detected. If an error occurs while parsing the data, the return value will be NULL. Additionally, if an error occurs and the error parameter is non-NULL, the error parameter will be set to a CFError describing the problem, which the caller must release. If the parse succeeds, the returned value is a reference to the new property list. It is the responsibility of the caller to release this value.
139133
*/
140134
CF_EXPORT
@@ -145,8 +139,6 @@ CFPropertyListRef CFPropertyListCreateWithStream(CFAllocatorRef allocator, CFRea
145139
CF_EXPORT
146140
CFIndex CFPropertyListWrite(CFPropertyListRef propertyList, CFWriteStreamRef stream, CFPropertyListFormat format, CFOptionFlags options, CFErrorRef *error) CF_AVAILABLE(10_6, 4_0);
147141

148-
#endif
149-
150142
/* Create a CFData with the bytes of a serialized property list. The format of the property list can be chosen with the format parameter. The options parameter is currently unused and should be set to 0. If an error occurs while parsing the data, the return value will be NULL. Additionally, if an error occurs and the error parameter is non-NULL, the error parameter will be set to a CFError describing the problem, which the caller must release. If the conversion succeeds, the returned value is a reference to the created data. It is the responsibility of the caller to release this value.
151143
*/
152144
CF_EXPORT

Foundation/NSArray.swift

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,10 @@ public class NSArray : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NS
3939
internal var _storage = [AnyObject]()
4040

4141
public var count: Int {
42-
get {
43-
if self.dynamicType === NSArray.self || self.dynamicType === NSMutableArray.self {
44-
return _storage.count
45-
} else {
46-
NSRequiresConcreteImplementation()
47-
}
42+
if self.dynamicType === NSArray.self || self.dynamicType === NSMutableArray.self {
43+
return _storage.count
44+
} else {
45+
NSRequiresConcreteImplementation()
4846
}
4947
}
5048

@@ -148,13 +146,11 @@ public class NSArray : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NS
148146
}
149147

150148
internal var allObjects: [AnyObject] {
151-
get {
152-
if self.dynamicType === NSArray.self || self.dynamicType === NSMutableArray.self {
153-
return _storage
154-
} else {
155-
return (0..<count).map { idx in
156-
return self[idx]
157-
}
149+
if self.dynamicType === NSArray.self || self.dynamicType === NSMutableArray.self {
150+
return _storage
151+
} else {
152+
return (0..<count).map { idx in
153+
return self[idx]
158154
}
159155
}
160156
}
@@ -274,22 +270,18 @@ public class NSArray : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NS
274270
}
275271

276272
public var firstObject: AnyObject? {
277-
get {
278-
if count > 0 {
279-
return objectAtIndex(0)
280-
} else {
281-
return nil
282-
}
273+
if count > 0 {
274+
return objectAtIndex(0)
275+
} else {
276+
return nil
283277
}
284278
}
285279

286280
public var lastObject: AnyObject? {
287-
get {
288-
if count > 0 {
289-
return objectAtIndex(count - 1)
290-
} else {
291-
return nil
292-
}
281+
if count > 0 {
282+
return objectAtIndex(count - 1)
283+
} else {
284+
return nil
293285
}
294286
}
295287

@@ -324,15 +316,13 @@ public class NSArray : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NS
324316
}
325317

326318
/*@NSCopying*/ public var sortedArrayHint: NSData {
327-
get {
328-
let buffer = UnsafeMutablePointer<Int32>.alloc(count)
329-
for idx in 0..<count {
330-
let item = objectAtIndex(idx) as! NSObject
331-
let hash = item.hash
332-
buffer.advancedBy(idx).memory = Int32(hash).littleEndian
333-
}
334-
return NSData(bytesNoCopy: unsafeBitCast(buffer, UnsafeMutablePointer<Void>.self), length: count * sizeof(Int), freeWhenDone: true)
319+
let buffer = UnsafeMutablePointer<Int32>.alloc(count)
320+
for idx in 0..<count {
321+
let item = objectAtIndex(idx) as! NSObject
322+
let hash = item.hash
323+
buffer.advancedBy(idx).memory = Int32(hash).littleEndian
335324
}
325+
return NSData(bytesNoCopy: unsafeBitCast(buffer, UnsafeMutablePointer<Void>.self), length: count * sizeof(Int), freeWhenDone: true)
336326
}
337327

338328
public func sortedArrayUsingFunction(comparator: @convention(c) (AnyObject, AnyObject, UnsafeMutablePointer<Void>) -> Int, context: UnsafeMutablePointer<Void>) -> [AnyObject] {
@@ -368,13 +358,11 @@ public class NSArray : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NS
368358
}
369359

370360
public subscript (idx: Int) -> AnyObject {
371-
get {
372-
guard idx < count && idx >= 0 else {
373-
fatalError("\(self): Index out of bounds")
374-
}
375-
376-
return objectAtIndex(idx)
361+
guard idx < count && idx >= 0 else {
362+
fatalError("\(self): Index out of bounds")
377363
}
364+
365+
return objectAtIndex(idx)
378366
}
379367

380368
public func enumerateObjectsUsingBlock(block: (AnyObject, Int, UnsafeMutablePointer<ObjCBool>) -> Void) {

Foundation/NSCFArray.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ internal final class _NSCFArray : NSMutableArray {
2525
}
2626

2727
override var count: Int {
28-
get {
29-
return CFArrayGetCount(_cfObject)
30-
}
28+
return CFArrayGetCount(_cfObject)
3129
}
3230

3331
override func objectAtIndex(index: Int) -> AnyObject {

Foundation/NSCFString.swift

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,13 @@ internal class _NSCFString : NSMutableString {
5555

5656
internal final class _NSCFConstantString : _NSCFString {
5757
internal var _ptr : UnsafePointer<UInt8> {
58-
get {
59-
let ptr = unsafeAddressOf(self) + sizeof(COpaquePointer) + sizeof(Int32) + sizeof(Int32) + sizeof(_CFInfo)
60-
return UnsafePointer<UnsafePointer<UInt8>>(ptr).memory
61-
}
58+
let ptr = unsafeAddressOf(self) + sizeof(COpaquePointer) + sizeof(Int32) + sizeof(Int32) + sizeof(_CFInfo)
59+
return UnsafePointer<UnsafePointer<UInt8>>(ptr).memory
6260
}
6361
internal var _length : UInt32 {
64-
get {
65-
let offset = sizeof(COpaquePointer) + sizeof(Int32) + sizeof(Int32) + sizeof(_CFInfo) + sizeof(UnsafePointer<UInt8>)
66-
let ptr = unsafeAddressOf(self) + offset
67-
return UnsafePointer<UInt32>(ptr).memory
68-
}
62+
let offset = sizeof(COpaquePointer) + sizeof(Int32) + sizeof(Int32) + sizeof(_CFInfo) + sizeof(UnsafePointer<UInt8>)
63+
let ptr = unsafeAddressOf(self) + offset
64+
return UnsafePointer<UInt32>(ptr).memory
6965
}
7066

7167
required init(characters: UnsafePointer<unichar>, length: Int) {

Foundation/NSCalendar.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ public class NSCalendar : NSObject, NSCopying, NSSecureCoding {
148148
}
149149

150150
public override var hash: Int {
151-
get {
152-
return Int(bitPattern: CFHash(_cfObject))
153-
}
151+
return Int(bitPattern: CFHash(_cfObject))
154152
}
155153

156154
public override func isEqual(object: AnyObject?) -> Bool {
@@ -162,9 +160,7 @@ public class NSCalendar : NSObject, NSCopying, NSSecureCoding {
162160
}
163161

164162
public override var description: String {
165-
get {
166-
return CFCopyDescription(_cfObject)._swiftObject
167-
}
163+
return CFCopyDescription(_cfObject)._swiftObject
168164
}
169165

170166
deinit {

Foundation/NSCharacterSet.swift

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ public class NSCharacterSet : NSObject, NSCopying, NSMutableCopying, NSCoding {
4646
}
4747

4848
public override var hash: Int {
49-
get {
50-
return Int(bitPattern: CFHash(_cfObject))
51-
}
49+
return Int(bitPattern: CFHash(_cfObject))
5250
}
5351

5452
public override func isEqual(object: AnyObject?) -> Bool {
@@ -60,9 +58,7 @@ public class NSCharacterSet : NSObject, NSCopying, NSMutableCopying, NSCoding {
6058
}
6159

6260
public override var description: String {
63-
get {
64-
return CFCopyDescription(_cfObject)._swiftObject
65-
}
61+
return CFCopyDescription(_cfObject)._swiftObject
6662
}
6763

6864
deinit {
@@ -161,15 +157,11 @@ public class NSCharacterSet : NSObject, NSCopying, NSMutableCopying, NSCoding {
161157
}
162158

163159
public var bitmapRepresentation: NSData {
164-
get {
165-
return CFCharacterSetCreateBitmapRepresentation(kCFAllocatorSystemDefault, _cfObject)._nsObject
166-
}
160+
return CFCharacterSetCreateBitmapRepresentation(kCFAllocatorSystemDefault, _cfObject)._nsObject
167161
}
168162

169163
public var invertedSet: NSCharacterSet {
170-
get {
171-
return CFCharacterSetCreateInvertedSet(kCFAllocatorSystemDefault, _cfObject)._nsObject
172-
}
164+
return CFCharacterSetCreateInvertedSet(kCFAllocatorSystemDefault, _cfObject)._nsObject
173165
}
174166

175167
public func longCharacterIsMember(theLongChar: UTF32Char) -> Bool {

Foundation/NSCoder.swift

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,7 @@ public class NSCoder : NSObject {
158158
}
159159

160160
public var allowsKeyedCoding: Bool {
161-
get {
162-
return false
163-
}
161+
return false
164162
}
165163

166164
public func encodeObject(objv: AnyObject?, forKey key: String) {
@@ -244,19 +242,15 @@ public class NSCoder : NSObject {
244242
}
245243

246244
public var requiresSecureCoding: Bool {
247-
get {
248-
return false
249-
}
245+
return false
250246
}
251247

252248
public func decodePropertyListForKey(key: String) -> AnyObject? {
253249
NSUnimplemented()
254250
}
255251

256252
public var allowedClasses: Set<NSObject>? {
257-
get {
258-
NSUnimplemented()
259-
}
253+
NSUnimplemented()
260254
}
261255

262256
public func failWithError(error: NSError) {

0 commit comments

Comments
 (0)