From 7386f00178be4fe1f8d8f749049d25cbf0533e6a Mon Sep 17 00:00:00 2001 From: Ryan Wilson Date: Tue, 28 Nov 2017 06:59:07 -0800 Subject: Replacing FIR_SWIFT_NAME macro with NS_SWIFT_NAME. (#476) * Replacing FIR_SWIFT_NAME macro with NS_SWIFT_NAME. This pushes the minimum Xcode version to 7.3, as NS_SWIFT_NAME was limited before that version (which is why the macro was introduced in the first place). * Fixed FIRMessaging header --- Firebase/Storage/Public/FIRStorage.h | 11 ++++---- Firebase/Storage/Public/FIRStorageConstants.h | 22 ++++++++-------- Firebase/Storage/Public/FIRStorageDownloadTask.h | 3 +-- Firebase/Storage/Public/FIRStorageMetadata.h | 4 +-- Firebase/Storage/Public/FIRStorageObservableTask.h | 3 +-- Firebase/Storage/Public/FIRStorageReference.h | 21 ++++++++-------- .../Storage/Public/FIRStorageSwiftNameSupport.h | 29 ---------------------- Firebase/Storage/Public/FIRStorageTask.h | 5 ++-- Firebase/Storage/Public/FIRStorageTaskSnapshot.h | 3 +-- Firebase/Storage/Public/FIRStorageUploadTask.h | 3 +-- 10 files changed, 32 insertions(+), 72 deletions(-) delete mode 100644 Firebase/Storage/Public/FIRStorageSwiftNameSupport.h (limited to 'Firebase/Storage') diff --git a/Firebase/Storage/Public/FIRStorage.h b/Firebase/Storage/Public/FIRStorage.h index 112b1c6..f70b875 100644 --- a/Firebase/Storage/Public/FIRStorage.h +++ b/Firebase/Storage/Public/FIRStorage.h @@ -17,7 +17,6 @@ #import #import "FIRStorageConstants.h" -#import "FIRStorageSwiftNameSupport.h" @class FIRApp; @class FIRStorageReference; @@ -38,28 +37,28 @@ FOUNDATION_EXPORT const unsigned char *const FIRStorageVersionString; * If you call [FIRStorage storageForApp:] and provide a custom instance of FIRApp, * the storage location will be specified via the FIROptions#storageBucket property. */ -FIR_SWIFT_NAME(Storage) +NS_SWIFT_NAME(Storage) @interface FIRStorage : NSObject /** * Creates an instance of FIRStorage, configured with the default FIRApp. * @return the FIRStorage instance, initialized with the default FIRApp. */ -+ (instancetype)storage FIR_SWIFT_NAME(storage()); ++ (instancetype)storage NS_SWIFT_NAME(storage()); /** * Creates an instance of FIRStorage, configured with the custom FIRApp @a app. * @param app The custom FIRApp used for initialization. * @return the FIRStorage instance, initialized with the custom FIRApp. */ -+ (instancetype)storageForApp:(FIRApp *)app FIR_SWIFT_NAME(storage(app:)); ++ (instancetype)storageForApp:(FIRApp *)app NS_SWIFT_NAME(storage(app:)); /** * Creates an instance of FIRStorage, configured with a custom storage bucket @a url. * @param url The gs:// url to your Firebase Storage Bucket. * @return the FIRStorage instance, initialized with the custom FIRApp. */ -+ (instancetype)storageWithURL:(NSString *)url FIR_SWIFT_NAME(storage(url:)); ++ (instancetype)storageWithURL:(NSString *)url NS_SWIFT_NAME(storage(url:)); /** * Creates an instance of FIRStorage, configured with a custom FIRApp @a app and a custom storage @@ -68,7 +67,7 @@ FIR_SWIFT_NAME(Storage) * @param url The gs:// url to your Firebase Storage Bucket. * @return the FIRStorage instance, initialized with the custom FIRApp. */ -+ (instancetype)storageForApp:(FIRApp *)app URL:(NSString *)url FIR_SWIFT_NAME(storage(app:url:)); ++ (instancetype)storageForApp:(FIRApp *)app URL:(NSString *)url NS_SWIFT_NAME(storage(app:url:)); /** * The Firebase App associated with this Firebase Storage instance. diff --git a/Firebase/Storage/Public/FIRStorageConstants.h b/Firebase/Storage/Public/FIRStorageConstants.h index cf6c3b8..be20135 100644 --- a/Firebase/Storage/Public/FIRStorageConstants.h +++ b/Firebase/Storage/Public/FIRStorageConstants.h @@ -16,8 +16,6 @@ #import -#import "FIRStorageSwiftNameSupport.h" - @class FIRStorageDownloadTask; @class FIRStorageMetadata; @class FIRStorageTaskSnapshot; @@ -28,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN /** * NSString typedef representing a task listener handle. */ -typedef NSString *FIRStorageHandle FIR_SWIFT_NAME(StorageHandle); +typedef NSString *FIRStorageHandle NS_SWIFT_NAME(StorageHandle); /** * Block typedef typically used when downloading data. @@ -36,21 +34,21 @@ typedef NSString *FIRStorageHandle FIR_SWIFT_NAME(StorageHandle); * @param error The error describing failure, if one occurred. */ typedef void (^FIRStorageVoidDataError)(NSData *_Nullable data, NSError *_Nullable error) - FIR_SWIFT_NAME(StorageVoidDataError); + NS_SWIFT_NAME(StorageVoidDataError); /** * Block typedef typically used when performing "binary" async operations such as delete, * where the operation either succeeds without an error or fails with an error. * @param error The error describing failure, if one occurred. */ -typedef void (^FIRStorageVoidError)(NSError *_Nullable error) FIR_SWIFT_NAME(StorageVoidError); +typedef void (^FIRStorageVoidError)(NSError *_Nullable error) NS_SWIFT_NAME(StorageVoidError); /** * Block typedef typically used when retrieving metadata. * @param metadata The metadata returned by the operation, if metadata exists. */ typedef void (^FIRStorageVoidMetadata)(FIRStorageMetadata *_Nullable metadata) - FIR_SWIFT_NAME(StorageVoidMetadata); + NS_SWIFT_NAME(StorageVoidMetadata); /** * Block typedef typically used when retrieving metadata with the possibility of an error. @@ -59,14 +57,14 @@ typedef void (^FIRStorageVoidMetadata)(FIRStorageMetadata *_Nullable metadata) */ typedef void (^FIRStorageVoidMetadataError)(FIRStorageMetadata *_Nullable metadata, NSError *_Nullable error) - FIR_SWIFT_NAME(StorageVoidMetadataError); + NS_SWIFT_NAME(StorageVoidMetadataError); /** * Block typedef typically used to asynchronously return a storage task snapshot. * @param snapshot The returned task snapshot. */ typedef void (^FIRStorageVoidSnapshot)(FIRStorageTaskSnapshot *snapshot) - FIR_SWIFT_NAME(StorageVoidSnapshot); + NS_SWIFT_NAME(StorageVoidSnapshot); /** * Block typedef typically used when retrieving a download URL. @@ -74,7 +72,7 @@ typedef void (^FIRStorageVoidSnapshot)(FIRStorageTaskSnapshot *snapshot) * @param error The error describing failure, if one occurred. */ typedef void (^FIRStorageVoidURLError)(NSURL *_Nullable URL, NSError *_Nullable error) - FIR_SWIFT_NAME(StorageVoidURLError); + NS_SWIFT_NAME(StorageVoidURLError); /** * Enum representing the upload and download task status. @@ -109,12 +107,12 @@ typedef NS_ENUM(NSInteger, FIRStorageTaskStatus) { * Task has failed and is unrecoverable. */ FIRStorageTaskStatusFailure -} FIR_SWIFT_NAME(StorageTaskStatus); +} NS_SWIFT_NAME(StorageTaskStatus); /** * Firebase Storage error domain. */ -FOUNDATION_EXPORT NSString *const FIRStorageErrorDomain FIR_SWIFT_NAME(StorageErrorDomain); +FOUNDATION_EXPORT NSString *const FIRStorageErrorDomain NS_SWIFT_NAME(StorageErrorDomain); /** * Enum representing the errors raised by Firebase Storage. @@ -168,6 +166,6 @@ typedef NS_ENUM(NSInteger, FIRStorageErrorCode) { /** User cancelled the operation. */ FIRStorageErrorCodeCancelled = -13040 -} FIR_SWIFT_NAME(StorageErrorCode); +} NS_SWIFT_NAME(StorageErrorCode); NS_ASSUME_NONNULL_END diff --git a/Firebase/Storage/Public/FIRStorageDownloadTask.h b/Firebase/Storage/Public/FIRStorageDownloadTask.h index f9d3e76..c11373f 100644 --- a/Firebase/Storage/Public/FIRStorageDownloadTask.h +++ b/Firebase/Storage/Public/FIRStorageDownloadTask.h @@ -17,7 +17,6 @@ #import #import "FIRStorageObservableTask.h" -#import "FIRStorageSwiftNameSupport.h" NS_ASSUME_NONNULL_BEGIN @@ -31,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN * specified callbackQueue in FIRStorage, or the main queue if left unspecified. * Currently all uploads must be initiated and managed on the main queue. */ -FIR_SWIFT_NAME(StorageDownloadTask) +NS_SWIFT_NAME(StorageDownloadTask) @interface FIRStorageDownloadTask : FIRStorageObservableTask @end diff --git a/Firebase/Storage/Public/FIRStorageMetadata.h b/Firebase/Storage/Public/FIRStorageMetadata.h index e6e001f..51f3547 100644 --- a/Firebase/Storage/Public/FIRStorageMetadata.h +++ b/Firebase/Storage/Public/FIRStorageMetadata.h @@ -16,8 +16,6 @@ #import -#import "FIRStorageSwiftNameSupport.h" - @class FIRStorageReference; NS_ASSUME_NONNULL_BEGIN @@ -29,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN * Objects#resource docs. * @see https://cloud.google.com/storage/docs/json_api/v1/objects#resource */ -FIR_SWIFT_NAME(StorageMetadata) +NS_SWIFT_NAME(StorageMetadata) @interface FIRStorageMetadata : NSObject /** diff --git a/Firebase/Storage/Public/FIRStorageObservableTask.h b/Firebase/Storage/Public/FIRStorageObservableTask.h index 502aba5..d8ad401 100644 --- a/Firebase/Storage/Public/FIRStorageObservableTask.h +++ b/Firebase/Storage/Public/FIRStorageObservableTask.h @@ -14,7 +14,6 @@ * limitations under the License. */ -#import "FIRStorageSwiftNameSupport.h" #import "FIRStorageTask.h" NS_ASSUME_NONNULL_BEGIN @@ -28,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN * observers at a later date. * This class is currently not thread safe and can only be called on the main thread. */ -FIR_SWIFT_NAME(StorageObservableTask) +NS_SWIFT_NAME(StorageObservableTask) @interface FIRStorageObservableTask : FIRStorageTask /** diff --git a/Firebase/Storage/Public/FIRStorageReference.h b/Firebase/Storage/Public/FIRStorageReference.h index a85c738..a63c127 100644 --- a/Firebase/Storage/Public/FIRStorageReference.h +++ b/Firebase/Storage/Public/FIRStorageReference.h @@ -20,7 +20,6 @@ #import "FIRStorageConstants.h" #import "FIRStorageDownloadTask.h" #import "FIRStorageMetadata.h" -#import "FIRStorageSwiftNameSupport.h" #import "FIRStorageTask.h" #import "FIRStorageUploadTask.h" @@ -32,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN * path. * @see https://cloud.google.com/storage/ */ -FIR_SWIFT_NAME(StorageReference) +NS_SWIFT_NAME(StorageReference) @interface FIRStorageReference : NSObject /** @@ -100,7 +99,7 @@ FIR_SWIFT_NAME(StorageReference) * @param uploadData The NSData to upload. * @return An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload. */ -- (FIRStorageUploadTask *)putData:(NSData *)uploadData FIR_SWIFT_NAME(putData(_:)); +- (FIRStorageUploadTask *)putData:(NSData *)uploadData NS_SWIFT_NAME(putData(_:)); /** * Asynchronously uploads data to the currently specified FIRStorageReference. @@ -113,7 +112,7 @@ FIR_SWIFT_NAME(StorageReference) // clang-format off - (FIRStorageUploadTask *)putData:(NSData *)uploadData metadata:(nullable FIRStorageMetadata *)metadata -FIR_SWIFT_NAME(putData(_:metadata:)); +NS_SWIFT_NAME(putData(_:metadata:)); // clang-format on /** @@ -131,7 +130,7 @@ FIR_SWIFT_NAME(putData(_:metadata:)); metadata:(nullable FIRStorageMetadata *)metadata completion:(nullable void (^)(FIRStorageMetadata *_Nullable metadata, NSError *_Nullable error))completion - FIR_SWIFT_NAME(putData(_:metadata:completion:)); + NS_SWIFT_NAME(putData(_:metadata:completion:)); // clang-format on /** @@ -140,7 +139,7 @@ FIR_SWIFT_NAME(putData(_:metadata:)); * @param fileURL A URL representing the system file path of the object to be uploaded. * @return An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload. */ -- (FIRStorageUploadTask *)putFile:(NSURL *)fileURL FIR_SWIFT_NAME(putFile(from:)); +- (FIRStorageUploadTask *)putFile:(NSURL *)fileURL NS_SWIFT_NAME(putFile(from:)); /** * Asynchronously uploads a file to the currently specified FIRStorageReference. @@ -152,7 +151,7 @@ FIR_SWIFT_NAME(putData(_:metadata:)); // clang-format off - (FIRStorageUploadTask *)putFile:(NSURL *)fileURL metadata:(nullable FIRStorageMetadata *)metadata - FIR_SWIFT_NAME(putFile(from:metadata:)); + NS_SWIFT_NAME(putFile(from:metadata:)); // clang-format on /** @@ -169,7 +168,7 @@ FIR_SWIFT_NAME(putData(_:metadata:)); metadata:(nullable FIRStorageMetadata *)metadata completion:(nullable void (^)(FIRStorageMetadata *_Nullable metadata, NSError *_Nullable error))completion - FIR_SWIFT_NAME(putFile(from:metadata:completion:)); + NS_SWIFT_NAME(putFile(from:metadata:completion:)); // clang-format on #pragma mark - Downloads @@ -188,7 +187,7 @@ FIR_SWIFT_NAME(putData(_:metadata:)); - (FIRStorageDownloadTask *)dataWithMaxSize:(int64_t)size completion:(void (^)(NSData *_Nullable data, NSError *_Nullable error))completion - FIR_SWIFT_NAME(getData(maxSize:completion:)); + NS_SWIFT_NAME(getData(maxSize:completion:)); // clang-format on /** @@ -229,7 +228,7 @@ FIR_SWIFT_NAME(putData(_:metadata:)); */ - (void)metadataWithCompletion: (void (^)(FIRStorageMetadata *_Nullable metadata, NSError *_Nullable error))completion - FIR_SWIFT_NAME(getMetadata(completion:)); + NS_SWIFT_NAME(getMetadata(completion:)); /** * Updates the metadata associated with an object at the current path. @@ -241,7 +240,7 @@ FIR_SWIFT_NAME(putData(_:metadata:)); - (void)updateMetadata:(FIRStorageMetadata *)metadata completion:(nullable void (^)(FIRStorageMetadata *_Nullable metadata, NSError *_Nullable error))completion -FIR_SWIFT_NAME(updateMetadata(_:completion:)); +NS_SWIFT_NAME(updateMetadata(_:completion:)); // clang-format on #pragma mark - Delete diff --git a/Firebase/Storage/Public/FIRStorageSwiftNameSupport.h b/Firebase/Storage/Public/FIRStorageSwiftNameSupport.h deleted file mode 100644 index 216c047..0000000 --- a/Firebase/Storage/Public/FIRStorageSwiftNameSupport.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef FIR_SWIFT_NAME - -#import - -// NS_SWIFT_NAME can only translate factory methods before the iOS 9.3 SDK. -// Wrap it in our own macro if it's a non-compatible SDK. -#ifdef __IPHONE_9_3 -#define FIR_SWIFT_NAME(X) NS_SWIFT_NAME(X) -#else -#define FIR_SWIFT_NAME(X) // Intentionally blank. -#endif // #ifdef __IPHONE_9_3 - -#endif // FIR_SWIFT_NAME diff --git a/Firebase/Storage/Public/FIRStorageTask.h b/Firebase/Storage/Public/FIRStorageTask.h index b49363c..e889d5e 100644 --- a/Firebase/Storage/Public/FIRStorageTask.h +++ b/Firebase/Storage/Public/FIRStorageTask.h @@ -18,7 +18,6 @@ #import "FIRStorageConstants.h" #import "FIRStorageMetadata.h" -#import "FIRStorageSwiftNameSupport.h" NS_ASSUME_NONNULL_BEGIN @@ -30,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN * If no queue is specified by the developer, it defaults to the main queue. * Currently not thread safe, so only call methods on the main thread. */ -FIR_SWIFT_NAME(StorageTask) +NS_SWIFT_NAME(StorageTask) @interface FIRStorageTask : NSObject /** @@ -46,7 +45,7 @@ FIR_SWIFT_NAME(StorageTask) * implement pause, resume, and cancel, which operate on the task to pause, resume, and cancel * operations. */ -FIR_SWIFT_NAME(StorageTaskManagement) +NS_SWIFT_NAME(StorageTaskManagement) @protocol FIRStorageTaskManagement @required diff --git a/Firebase/Storage/Public/FIRStorageTaskSnapshot.h b/Firebase/Storage/Public/FIRStorageTaskSnapshot.h index b654c09..7d14202 100644 --- a/Firebase/Storage/Public/FIRStorageTaskSnapshot.h +++ b/Firebase/Storage/Public/FIRStorageTaskSnapshot.h @@ -17,7 +17,6 @@ #import #import "FIRStorageConstants.h" -#import "FIRStorageSwiftNameSupport.h" NS_ASSUME_NONNULL_BEGIN @@ -30,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN * A Snapshot contains a task, storage reference, metadata (if it exists), * progress, and an error (if one occurred). */ -FIR_SWIFT_NAME(StorageTaskSnapshot) +NS_SWIFT_NAME(StorageTaskSnapshot) @interface FIRStorageTaskSnapshot : NSObject /** diff --git a/Firebase/Storage/Public/FIRStorageUploadTask.h b/Firebase/Storage/Public/FIRStorageUploadTask.h index cf9bde8..c753500 100644 --- a/Firebase/Storage/Public/FIRStorageUploadTask.h +++ b/Firebase/Storage/Public/FIRStorageUploadTask.h @@ -17,7 +17,6 @@ #import #import "FIRStorageObservableTask.h" -#import "FIRStorageSwiftNameSupport.h" NS_ASSUME_NONNULL_BEGIN @@ -31,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN * specified callbackQueue in FIRStorage, or the main queue if left unspecified. * Currently all uploads must be initiated and managed on the main queue. */ -FIR_SWIFT_NAME(StorageUploadTask) +NS_SWIFT_NAME(StorageUploadTask) @interface FIRStorageUploadTask : FIRStorageObservableTask @end -- cgit v1.2.3