-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Merge FirebaseStorageSwift and FirebaseStorage #9045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Generated by 🚫 Danger |
list(maxResults: maxResults, | ||
pageToken: pageToken, | ||
completion: getResultCallback(completion: completion)) | ||
__list(withMaxResults: maxResults, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
list implementation for Swift clients that will find the error handling in Result.swift
(void (^)(FIRStorageListResult *result, NSError *_Nullable error))completion | ||
NS_SWIFT_NAME(list(maxResults:completion:)); | ||
completion:(void (^)(FIRStorageListResult *result, | ||
NSError *_Nullable error))completion NS_REFINED_FOR_SWIFT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hide API for Swift
@@ -12,7 +12,7 @@ | |||
// See the License for the specific language governing permissions and | |||
// limitations under the License. | |||
|
|||
import FirebaseStorage | |||
@_exported import FirebaseStorageObjC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pass Objective C APIS through to Swift.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM – thanks for the thorough writeup! Left mostly nits below. Feel free to defer to future PRs.
FirebaseCombineSwift/Tests/Unit/Storage/StorageReferenceTests.swift
Outdated
Show resolved
Hide resolved
FirebaseStorage/Sources/Public/FirebaseStorage/FIRStorageReference.h
Outdated
Show resolved
Hide resolved
FirebaseStorage/Sources/Public/FirebaseStorage/FIRStorageReference.h
Outdated
Show resolved
Hide resolved
Going to merge this here to storage-v9 since this now demonstrates an always Swift-on top library approach along with providing the structure to pass through and/or override any Objective C API. I'll address open questions and next steps in subsequent PRs. Feel free to continue to add comments and I'll address those as well. |
We originally thought that we could move to combined Swift/ObjC libraries with a single combined CocoaPod and a dependent SwiftPM library. However, that strategy is problematic since it makes usability of public imports different between the two package managers, along with testing and usability complications.
This PR prototypes using the same library structure for both. It also solves the problem of providing Swift error codes for any API that needs them by using
REFINED_FOR_SWIFT
for any applicable API and wrapping the error handling in a Swift specific API. See thelist
API implementation.I believe we have two unavoidable breakages:
Open Questions:
@_exported import FirebaseStorageObjC
to pass through Objective C APIs or should we explicitly wrap all of them in Swift after marking them asREFINED_FOR_SWIFT
?can_import
to continue to supportimport Firebase
?Next Steps for Storage:
list