diff --git a/Configurations/ParseUnitTests-OSX.xcconfig b/Configurations/ParseUnitTests-OSX.xcconfig index eaec1f311..f3c52a774 100644 --- a/Configurations/ParseUnitTests-OSX.xcconfig +++ b/Configurations/ParseUnitTests-OSX.xcconfig @@ -18,6 +18,3 @@ INFOPLIST_FILE = $(SRCROOT)/Tests/Resources/ParseUnitTests-OSX-Info.plist LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks @loader_path/../Frameworks @executable_path/Frameworks @loader_path/Frameworks USER_HEADER_SEARCH_PATHS = $(inherited) $(PARSE_DIR)/Parse/Internal/** - -// Swift -SWIFT_OBJC_BRIDGING_HEADER = $(SRCROOT)/Tests/Other/Swift/ParseUnitTests-OSX-Bridging-Header.h diff --git a/Configurations/ParseUnitTests-iOS.xcconfig b/Configurations/ParseUnitTests-iOS.xcconfig index 68d19da2b..0c93ec95b 100644 --- a/Configurations/ParseUnitTests-iOS.xcconfig +++ b/Configurations/ParseUnitTests-iOS.xcconfig @@ -19,6 +19,3 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0 INFOPLIST_FILE = $(SRCROOT)/Tests/Resources/ParseUnitTests-iOS-Info.plist USER_HEADER_SEARCH_PATHS = $(inherited) $(PARSE_DIR)/Parse/Internal/** - -// Swift -SWIFT_OBJC_BRIDGING_HEADER = $(SRCROOT)/Tests/Other/Swift/ParseUnitTests-iOS-Bridging-Header.h diff --git a/Parse.xcodeproj/project.pbxproj b/Parse.xcodeproj/project.pbxproj index c88629334..767adb10b 100644 --- a/Parse.xcodeproj/project.pbxproj +++ b/Parse.xcodeproj/project.pbxproj @@ -2634,7 +2634,6 @@ F5B0B30C1B449F1D00F3EBC4 /* PFLocationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 97E18AE41623835600B17A67 /* PFLocationManager.h */; }; F5B0B30D1B449F1D00F3EBC4 /* PFAsyncTaskQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C8F2BE1B1F7E6B00CD98E7 /* PFAsyncTaskQueue.h */; }; F5B0B30E1B449F1D00F3EBC4 /* PFBaseState.h in Headers */ = {isa = PBXBuildFile; fileRef = F586B34E1B1E3BD70082E3BD /* PFBaseState.h */; }; - F5B0B3131B44A05100F3EBC4 /* PFPaymentTransactionObserver_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = F5B0B3121B44A05100F3EBC4 /* PFPaymentTransactionObserver_Private.h */; }; F5B0B3151B44A21100F3EBC4 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5B0B3141B44A21100F3EBC4 /* SystemConfiguration.framework */; }; F5B0B3161B44A22300F3EBC4 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0942999C139C613700DFA018 /* SystemConfiguration.framework */; }; F5B0B3171B44A2CA00F3EBC4 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 498C29FE1551DC450034BB80 /* StoreKit.framework */; }; @@ -3017,8 +3016,6 @@ 810ECA6F1B573853002944D4 /* PFRelationPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PFRelationPrivate.h; sourceTree = ""; }; 810ECC611B573B96002944D4 /* ParseUnitTests-iOS-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "ParseUnitTests-iOS-Info.plist"; sourceTree = ""; }; 810ECC621B573B96002944D4 /* ParseUnitTests-OSX-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "ParseUnitTests-OSX-Info.plist"; sourceTree = ""; }; - 810ECC6C1B573C6B002944D4 /* ParseUnitTests-iOS-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ParseUnitTests-iOS-Bridging-Header.h"; sourceTree = ""; }; - 810ECC6D1B573C6B002944D4 /* ParseUnitTests-OSX-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ParseUnitTests-OSX-Bridging-Header.h"; sourceTree = ""; }; 810ECC6E1B573C6B002944D4 /* SwiftSubclass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftSubclass.swift; sourceTree = ""; }; 810ECC721B573CC5002944D4 /* OCMock+Parse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OCMock+Parse.h"; sourceTree = ""; }; 810ECC731B573CC5002944D4 /* OCMock+Parse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "OCMock+Parse.m"; sourceTree = ""; }; @@ -3947,8 +3944,6 @@ 810ECC6B1B573C6B002944D4 /* Swift */ = { isa = PBXGroup; children = ( - 810ECC6C1B573C6B002944D4 /* ParseUnitTests-iOS-Bridging-Header.h */, - 810ECC6D1B573C6B002944D4 /* ParseUnitTests-OSX-Bridging-Header.h */, 810ECC6E1B573C6B002944D4 /* SwiftSubclass.swift */, ); path = Swift; @@ -5730,7 +5725,6 @@ 81329E8E1AE1E8840071EE3E /* PFReachability.h in Headers */, 81CA29F01C28ECFD00C4F34A /* PFUser+Deprecated.h in Headers */, 81C7F4AC1AF42BD9007B5418 /* PFMutableQueryState.h in Headers */, - F5B0B3131B44A05100F3EBC4 /* PFPaymentTransactionObserver_Private.h in Headers */, 81CB7F991B17970400DC601D /* PFPushState_Private.h in Headers */, 81C7F4A21AF4220A007B5418 /* PFMutableFileState.h in Headers */, 8124C8AC1B27D5D600758E00 /* PFSessionUtilities.h in Headers */, diff --git a/Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m b/Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m index eeb175867..91e740d71 100644 --- a/Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m +++ b/Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m @@ -11,13 +11,14 @@ #import +#import +#import + #import "PFAssert.h" #import "PFMacros.h" -#import "PFObject.h" #import "PFObjectSubclassInfo.h" #import "PFPropertyInfo_Private.h" #import "PFPropertyInfo_Runtime.h" -#import "PFSubclassing.h" // CFNumber does not use number type 0, we take advantage of that here. #define kCFNumberTypeUnknown 0 diff --git a/Parse/PFObject+Subclass.h b/Parse/PFObject+Subclass.h index 2c3599ddd..68bd5aa17 100644 --- a/Parse/PFObject+Subclass.h +++ b/Parse/PFObject+Subclass.h @@ -69,10 +69,17 @@ NS_ASSUME_NONNULL_BEGIN For example, `[PFUser object]` will return a `MyUser` object if `MyUser` is a registered subclass of `PFUser`. For this reason, `[MyClass object]` is preferred to `[[MyClass alloc] init]`. This method can only be called on subclasses which conform to `PFSubclassing`. - A default implementation is provided by `PFObject` which should always be sufficient. */ + (instancetype)object; +/** + The following ignore statement is required, as otherwise, every time this is compiled - it produces an `swift_name` unused warning. + This appears to be a clang itself or ClangImporter issue when imported into Swift. + */ + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wignored-attributes" + /** Creates a reference to an existing `PFObject` for use in creating associations between `PFObjects`. @@ -85,7 +92,9 @@ NS_ASSUME_NONNULL_BEGIN @return An instance of `PFObject` without data. */ -+ (instancetype)objectWithoutDataWithObjectId:(nullable NSString *)objectId; ++ (instancetype)objectWithoutDataWithObjectId:(nullable NSString *)objectId NS_SWIFT_NAME(init(withoutDataWithObjectId:)); + +#pragma clang diagnostic pop /** Registers an Objective-C class for Parse to use for representing a given Parse class. @@ -102,7 +111,7 @@ NS_ASSUME_NONNULL_BEGIN This method can only be called on subclasses which conform to `PFSubclassing`. A default implementation is provided by `PFObject` which should always be sufficient. - + @see `PFQuery` */ + (nullable PFQuery *)query; diff --git a/Parse/PFSubclassing.h b/Parse/PFSubclassing.h index 6cbd71a26..784da176f 100644 --- a/Parse/PFSubclassing.h +++ b/Parse/PFSubclassing.h @@ -55,7 +55,7 @@ NS_ASSUME_NONNULL_BEGIN @return A new `PFObject` without data. */ -+ (instancetype)objectWithoutDataWithObjectId:(nullable NSString *)objectId; ++ (instancetype)objectWithoutDataWithObjectId:(nullable NSString *)objectId PF_SWIFT_UNAVAILABLE; /** Create a query which returns objects of this type. diff --git a/Tests/Other/Swift/ParseUnitTests-OSX-Bridging-Header.h b/Tests/Other/Swift/ParseUnitTests-OSX-Bridging-Header.h deleted file mode 100644 index d35c96c03..000000000 --- a/Tests/Other/Swift/ParseUnitTests-OSX-Bridging-Header.h +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) 2015-present, Parse, LLC. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import -#import diff --git a/Tests/Other/Swift/ParseUnitTests-iOS-Bridging-Header.h b/Tests/Other/Swift/ParseUnitTests-iOS-Bridging-Header.h deleted file mode 100644 index d35c96c03..000000000 --- a/Tests/Other/Swift/ParseUnitTests-iOS-Bridging-Header.h +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) 2015-present, Parse, LLC. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import -#import diff --git a/Tests/Other/Swift/SwiftSubclass.swift b/Tests/Other/Swift/SwiftSubclass.swift index f3576e371..6db82970c 100644 --- a/Tests/Other/Swift/SwiftSubclass.swift +++ b/Tests/Other/Swift/SwiftSubclass.swift @@ -9,6 +9,8 @@ import Foundation +import Parse + @objc public class SwiftSubclass: PFObject, PFSubclassing { @NSManaged public var primitiveProperty: Int @@ -20,4 +22,8 @@ public class SwiftSubclass: PFObject, PFSubclassing { public static func parseClassName() -> String { return "SwiftSubclass" } + + func test_validateSwiftImport() { + let _ = SwiftSubclass(withoutDataWithObjectId: "") + } } diff --git a/Tests/Unit/ObjectSubclassingControllerTests.m b/Tests/Unit/ObjectSubclassingControllerTests.m index 233b6dc28..e2a564931 100644 --- a/Tests/Unit/ObjectSubclassingControllerTests.m +++ b/Tests/Unit/ObjectSubclassingControllerTests.m @@ -7,11 +7,12 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -#import "PFObject+Subclass.h" +#import +#import +#import + #import "PFObjectPrivate.h" #import "PFObjectSubclassingController.h" -#import "PFRelation.h" -#import "PFSubclassing.h" #import "PFUnitTestCase.h" #import "ParseUnitTests-Swift.h"