Browse Source

Limit Swift line lengths to 100 (#5315)

Paul Beusterien 6 years ago
parent
commit
595fa9713a
36 changed files with 561 additions and 261 deletions
  1. 12 5
      CoreOnly/Tests/FirebasePodTest/FirebasePodTest/AppDelegate.swift
  2. 3 1
      CoreOnly/Tests/FirebasePodTest/FirebasePodTest/SceneDelegate.swift
  3. 70 54
      Example/Auth/ApiTests/PhoneMultiFactorTests.swift
  4. 10 3
      Example/Messaging/Sample/iOS/AppDelegate.swift
  5. 2 1
      Example/Messaging/Sample/iOS/MessagingViewController.swift
  6. 5 2
      Example/Messaging/Sample/iOS/NotificationsController.swift
  7. 3 1
      Example/tvOSSample/tvOSSample/AppDelegate.swift
  8. 2 1
      Example/tvOSSample/tvOSSample/StorageViewController.swift
  9. 25 8
      Example/watchOSSample/SampleWatchAppWatchKitExtension/ComplicationController.swift
  10. 5 2
      Example/watchOSSample/ServiceExtension/NotificationService.swift
  11. 3 1
      FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp/FiamDisplaySwiftExample/AppDelegate.swift
  12. 10 5
      FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp/FiamDisplaySwiftExample/BannerMessageViewController.swift
  13. 24 12
      FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp/FiamDisplaySwiftExample/CardMessageViewController.swift
  14. 8 5
      FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp/FiamDisplaySwiftExample/CommonMessageTestVC.swift
  15. 10 5
      FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp/FiamDisplaySwiftExample/ImageOnlyMessageViewController.swift
  16. 10 5
      FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp/FiamDisplaySwiftExample/ModalMessageViewController.swift
  17. 2 4
      FirebaseStorageSwift/Tests/Integration/StorageIntegration.swift
  18. 4 3
      Firestore/Swift/Source/Codable/CollectionReference+WriteEncodable.swift
  19. 6 3
      Firestore/Swift/Source/Codable/Transaction+WriteEncodable.swift
  20. 6 3
      Firestore/Swift/Source/Codable/WriteBatch+WriteEncodable.swift
  21. 14 6
      Firestore/Swift/Tests/Codable/FirestoreEncoderTests.swift
  22. 10 5
      Firestore/Swift/Tests/Integration/CodableIntegrationTests.swift
  23. 103 36
      Firestore/third_party/FirestoreEncoder/FirestoreDecoder.swift
  24. 97 30
      Firestore/third_party/FirestoreEncoder/FirestoreEncoder.swift
  25. 7 3
      GoogleDataTransport/GDTTestApp/app.swift
  26. 4 2
      GoogleDataTransport/GDTTestApp/gdthelpers.swift
  27. 15 7
      GoogleDataTransportCCTSupport/GDTCCTTestApp/app.swift
  28. 4 2
      Metrics/Sources/MetricsLib/UploadMetrics.swift
  29. 6 3
      Metrics/Tests/MetricsTests/UploadMetricsTests.swift
  30. 10 5
      ZipBuilder/Sources/ZipBuilder/CocoaPodUtils.swift
  31. 2 1
      ZipBuilder/Sources/ZipBuilder/FirebaseBuilder.swift
  32. 28 14
      ZipBuilder/Sources/ZipBuilder/FrameworkBuilder.swift
  33. 5 2
      ZipBuilder/Sources/ZipBuilder/ModuleMapBuilder.swift
  34. 3 1
      ZipBuilder/Sources/ZipBuilder/ResourcesManager.swift
  35. 31 20
      ZipBuilder/Sources/ZipBuilder/ZipBuilder.swift
  36. 2 0
      scripts/style.sh

+ 12 - 5
CoreOnly/Tests/FirebasePodTest/FirebasePodTest/AppDelegate.swift

@@ -26,7 +26,8 @@ class FirestoreExists: Firestore {}
 class FunctionsExists: Functions {}
 class InAppMessagingExists: InAppMessaging {}
 class InAppMessagingDisplayExists: InAppMessagingDisplay { // protocol instead of interface
-  func displayMessage(_ messageForDisplay: InAppMessagingDisplayMessage, displayDelegate: InAppMessagingDisplayDelegate) {}
+  func displayMessage(_ messageForDisplay: InAppMessagingDisplayMessage,
+                      displayDelegate: InAppMessagingDisplayDelegate) {}
 }
 
 class MessagingExists: Messaging {}
@@ -36,20 +37,26 @@ class StorageExists: Storage {}
 
 @UIApplicationMain
 class AppDelegate: UIResponder, UIApplicationDelegate {
-  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
+  func application(_ application: UIApplication,
+                   didFinishLaunchingWithOptions launchOptions: [UIApplication
+                     .LaunchOptionsKey: Any]?) -> Bool {
     // Override point for customization after application launch.
     return true
   }
 
   // MARK: UISceneSession Lifecycle
 
-  func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
+  func application(_ application: UIApplication,
+                   configurationForConnecting connectingSceneSession: UISceneSession,
+                   options: UIScene.ConnectionOptions) -> UISceneConfiguration {
     // Called when a new scene session is being created.
     // Use this method to select a configuration to create the new scene with.
-    return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
+    return UISceneConfiguration(name: "Default Configuration",
+                                sessionRole: connectingSceneSession.role)
   }
 
-  func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
+  func application(_ application: UIApplication,
+                   didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
     // Called when the user discards a scene session.
     // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
     // Use this method to release any resources that were specific to the discarded scenes, as they will not return.

+ 3 - 1
CoreOnly/Tests/FirebasePodTest/FirebasePodTest/SceneDelegate.swift

@@ -17,7 +17,9 @@ import UIKit
 class SceneDelegate: UIResponder, UIWindowSceneDelegate {
   var window: UIWindow?
 
-  func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
+  func scene(_ scene: UIScene,
+             willConnectTo session: UISceneSession,
+             options connectionOptions: UIScene.ConnectionOptions) {
     // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
     // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
     // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).

+ 70 - 54
Example/Auth/ApiTests/PhoneMultiFactorTests.swift

@@ -30,77 +30,93 @@ class PhoneMultiFactorTests: FIRAuthApiTestsBase {
   func testEnrollUnenroll() {
     let enrollExpectation = expectation(description: "Enroll phone multi factor finished.")
     let unenrollExpectation = expectation(description: "Unenroll phone multi factor finished.")
-    Auth.auth().signIn(withEmail: kNoSecondFactorUserEmail, password: kNoSecondFactorUserPassword) { result, error in
-      XCTAssertNil(error, "User normal sign in failed. Error: \(error!.localizedDescription)")
+    Auth.auth()
+      .signIn(withEmail: kNoSecondFactorUserEmail,
+              password: kNoSecondFactorUserPassword) { result, error in
+        XCTAssertNil(error, "User normal sign in failed. Error: \(error!.localizedDescription)")
 
-      // Enroll
-      guard let user = result?.user else {
-        XCTFail("No valid user after attempted sign-in.")
-      }
-      user.multiFactor.getSessionWithCompletion { session, error in
-        XCTAssertNil(error, "Get multi factor session failed. Error: \(error!.localizedDescription)")
-        PhoneAuthProvider.provider().verifyPhoneNumber(
-          kPhoneSecondFactorPhoneNumber,
-          uiDelegate: nil,
-          multiFactorSession: session
-        ) { verificationId, error in
-          XCTAssertNil(error, "Verify phone number failed. Error: \(error!.localizedDescription)")
-          let credential = PhoneAuthProvider.provider().credential(
-            withVerificationID: verificationId!,
-            verificationCode: kPhoneSecondFactorVerificationCode
-          )
-          let assertion = PhoneMultiFactorGenerator.assertion(with: credential)
-          user?.multiFactor.enroll(with: assertion, displayName: kPhoneSecondFactorDisplayName) { error in
-            XCTAssertNil(error, "Phone multi factor enroll failed. Error: \(error!.localizedDescription)")
-            XCTAssertEqual(Auth.auth().currentUser?.multiFactor.enrolledFactors.first?.displayName, kPhoneSecondFactorDisplayName)
-            enrollExpectation.fulfill()
+        // Enroll
+        guard let user = result?.user else {
+          XCTFail("No valid user after attempted sign-in.")
+        }
+        user.multiFactor.getSessionWithCompletion { session, error in
+          XCTAssertNil(error,
+                       "Get multi factor session failed. Error: \(error!.localizedDescription)")
+          PhoneAuthProvider.provider().verifyPhoneNumber(
+            kPhoneSecondFactorPhoneNumber,
+            uiDelegate: nil,
+            multiFactorSession: session
+          ) { verificationId, error in
+            XCTAssertNil(error, "Verify phone number failed. Error: \(error!.localizedDescription)")
+            let credential = PhoneAuthProvider.provider().credential(
+              withVerificationID: verificationId!,
+              verificationCode: kPhoneSecondFactorVerificationCode
+            )
+            let assertion = PhoneMultiFactorGenerator.assertion(with: credential)
+            user?.multiFactor
+              .enroll(with: assertion, displayName: kPhoneSecondFactorDisplayName) { error in
+                XCTAssertNil(error,
+                             "Phone multi factor enroll failed. Error: \(error!.localizedDescription)")
+                XCTAssertEqual(Auth.auth().currentUser?.multiFactor.enrolledFactors.first?
+                  .displayName,
+                               kPhoneSecondFactorDisplayName)
+                enrollExpectation.fulfill()
 
-            // Unenroll
-            user = Auth.auth().currentUser
-            user?.multiFactor.unenroll(with: (user?.multiFactor.enrolledFactors.first)!, completion: { error in
-              XCTAssertNil(error, "Phone multi factor unenroll failed. Error: \(error!.localizedDescription)")
-              XCTAssertEqual(Auth.auth().currentUser?.multiFactor.enrolledFactors.count, 0)
-              unenrollExpectation.fulfill()
+                // Unenroll
+                user = Auth.auth().currentUser
+                user?.multiFactor
+                  .unenroll(with: (user?.multiFactor.enrolledFactors.first)!, completion: { error in
+                    XCTAssertNil(error,
+                                 "Phone multi factor unenroll failed. Error: \(error!.localizedDescription)")
+                    XCTAssertEqual(Auth.auth().currentUser?.multiFactor.enrolledFactors.count, 0)
+                    unenrollExpectation.fulfill()
             })
+              }
           }
         }
       }
-    }
 
     waitForExpectations(timeout: 30) { error in
-      XCTAssertNil(error, "Failed to wait for enroll and unenroll phone multi factor finished. Error: \(error!.localizedDescription)")
+      XCTAssertNil(error,
+                   "Failed to wait for enroll and unenroll phone multi factor finished. Error: \(error!.localizedDescription)")
     }
   }
 
   func testSignInWithSecondFactor() {
     let signInExpectation = expectation(description: "Sign in with phone multi factor finished.")
-    Auth.auth().signIn(withEmail: kOneSecondFactorUserEmail, password: kOneSecondFactorUserPassword) { result, error in
-      // SignIn
-      guard let error = error, error.code == AuthErrorCode.secondFactorRequired.rawValue else {
-        XCTFail("User sign in returns wrong error. Error: \(error!.localizedDescription)")
-      }
-      let resolver = error.userInfo["FIRAuthErrorUserInfoMultiFactorResolverKey"] as! MultiFactorResolver
-      let hint = resolver.hints.first as! PhoneMultiFactorInfo
-      PhoneAuthProvider.provider().verifyPhoneNumber(
-        with: hint,
-        uiDelegate: nil,
-        multiFactorSession: resolver.session
-      ) { verificationId, error in
-        XCTAssertNil(error, "Failed to verify phone number. Error: \(error!.localizedDescription)")
-        let credential = PhoneAuthProvider.provider().credential(
-          withVerificationID: verificationId!,
-          verificationCode: kPhoneSecondFactorVerificationCode
-        )
-        let assertion = PhoneMultiFactorGenerator.assertion(with: credential)
-        resolver.resolveSignIn(with: assertion) { authResult, error in
-          XCTAssertNil(error, "Failed to sign in with phone multi factor. Error: \(error!.localizedDescription)")
-          signInExpectation.fulfill()
+    Auth.auth()
+      .signIn(withEmail: kOneSecondFactorUserEmail,
+              password: kOneSecondFactorUserPassword) { result, error in
+        // SignIn
+        guard let error = error, error.code == AuthErrorCode.secondFactorRequired.rawValue else {
+          XCTFail("User sign in returns wrong error. Error: \(error!.localizedDescription)")
+        }
+        let resolver = error
+          .userInfo["FIRAuthErrorUserInfoMultiFactorResolverKey"] as! MultiFactorResolver
+        let hint = resolver.hints.first as! PhoneMultiFactorInfo
+        PhoneAuthProvider.provider().verifyPhoneNumber(
+          with: hint,
+          uiDelegate: nil,
+          multiFactorSession: resolver.session
+        ) { verificationId, error in
+          XCTAssertNil(error,
+                       "Failed to verify phone number. Error: \(error!.localizedDescription)")
+          let credential = PhoneAuthProvider.provider().credential(
+            withVerificationID: verificationId!,
+            verificationCode: kPhoneSecondFactorVerificationCode
+          )
+          let assertion = PhoneMultiFactorGenerator.assertion(with: credential)
+          resolver.resolveSignIn(with: assertion) { authResult, error in
+            XCTAssertNil(error,
+                         "Failed to sign in with phone multi factor. Error: \(error!.localizedDescription)")
+            signInExpectation.fulfill()
+          }
         }
       }
-    }
 
     waitForExpectations(timeout: 300) { error in
-      XCTAssertNil(error, "Failed to wait for enroll and unenroll phone multi factor finished. Error: \(error!.localizedDescription)")
+      XCTAssertNil(error,
+                   "Failed to wait for enroll and unenroll phone multi factor finished. Error: \(error!.localizedDescription)")
     }
   }
 }

+ 10 - 3
Example/Messaging/Sample/iOS/AppDelegate.swift

@@ -33,7 +33,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
 
   static var hasPresentedInvalidServiceInfoPlistAlert = false
 
-  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
+  func application(_ application: UIApplication,
+                   didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?)
+    -> Bool {
     guard !AppDelegate.isWithinUnitTest else {
       // During unit tests, we don't want to initialize Firebase, since by default we want to able
       // to run unit tests without requiring a non-dummy GoogleService-Info.plist file
@@ -85,7 +87,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     NotificationCenter.default.post(name: UserNotificationsChangedNotification, object: nil)
   }
 
-  func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
+  func application(_ application: UIApplication,
+                   didReceiveRemoteNotification userInfo: [AnyHashable: Any],
+                   fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult)
+                     -> Void) {
     print("application:didReceiveRemoteNotification:fetchCompletionHandler: called, with notification:")
     print("\(userInfo.jsonString ?? "{}")")
     completionHandler(.newData)
@@ -131,7 +136,9 @@ extension AppDelegate: MessagingDelegate {
 
 extension AppDelegate {
   func listenForDirectChannelStateChanges() {
-    NotificationCenter.default.addObserver(self, selector: #selector(onMessagingDirectChannelStateChanged(_:)), name: .MessagingConnectionStateChanged, object: nil)
+    NotificationCenter.default
+      .addObserver(self, selector: #selector(onMessagingDirectChannelStateChanged(_:)),
+                   name: .MessagingConnectionStateChanged, object: nil)
   }
 
   func onMessagingDirectChannelStateChanged(_ notification: Notification) {

+ 2 - 1
Example/Messaging/Sample/iOS/MessagingViewController.swift

@@ -153,7 +153,8 @@ class MessagingViewController: UIViewController {
   }()
 
   lazy var apnsStatusTableCell: UITableViewCell = {
-    let cell = UITableViewCell(style: UITableViewCellStyle.value1, reuseIdentifier: Row.apnsStatus.rawValue)
+    let cell = UITableViewCell(style: UITableViewCellStyle.value1,
+                               reuseIdentifier: Row.apnsStatus.rawValue)
     cell.textLabel?.text = "Allowed:"
     cell.detailTextLabel?.numberOfLines = 0
     cell.detailTextLabel?.lineBreakMode = .byWordWrapping

+ 5 - 2
Example/Messaging/Sample/iOS/NotificationsController.swift

@@ -52,7 +52,8 @@ class NotificationsController: NSObject {
       UNUserNotificationCenter.current()
         .requestAuthorization(options: [.alert, .badge, .sound],
                               completionHandler: { granted, error in
-                                NotificationCenter.default.post(name: UserNotificationsChangedNotification, object: nil)
+                                NotificationCenter.default
+                                  .post(name: UserNotificationsChangedNotification, object: nil)
         })
     } else if #available(iOS 8.0, *) {
       let userNotificationSettings = UIUserNotificationSettings(types: [.alert, .badge, .sound],
@@ -131,7 +132,9 @@ extension NotificationsController: UNUserNotificationCenterDelegate {
     completionHandler([.alert, .badge, .sound])
   }
 
-  func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
+  func userNotificationCenter(_ center: UNUserNotificationCenter,
+                              didReceive response: UNNotificationResponse,
+                              withCompletionHandler completionHandler: @escaping () -> Void) {
     print("Received notification response")
     let jsonString = response.notification.request.content.userInfo.jsonString ?? "{}"
     print("\(jsonString)")

+ 3 - 1
Example/tvOSSample/tvOSSample/AppDelegate.swift

@@ -19,7 +19,9 @@ import FirebaseCore
 class AppDelegate: UIResponder, UIApplicationDelegate {
   var window: UIWindow?
 
-  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
+  func application(_ application: UIApplication,
+                   didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?)
+    -> Bool {
     // Override point for customization after application launch.
     FirebaseApp.configure()
     return true

+ 2 - 1
Example/tvOSSample/tvOSSample/StorageViewController.swift

@@ -31,7 +31,8 @@ class StorageViewController: UIViewController {
     case failed(String)
 
     /// Equatable support for UIState.
-    static func == (lhs: StorageViewController.UIState, rhs: StorageViewController.UIState) -> Bool {
+    static func == (lhs: StorageViewController.UIState,
+                    rhs: StorageViewController.UIState) -> Bool {
       switch (lhs, rhs) {
       case (.cleared, .cleared): return true
       case (.downloading, .downloading): return true

+ 25 - 8
Example/watchOSSample/SampleWatchAppWatchKitExtension/ComplicationController.swift

@@ -17,42 +17,59 @@ import ClockKit
 class ComplicationController: NSObject, CLKComplicationDataSource {
   // MARK: - Timeline Configuration
 
-  func getSupportedTimeTravelDirections(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimeTravelDirections) -> Void) {
+  func getSupportedTimeTravelDirections(for complication: CLKComplication,
+                                        withHandler handler: @escaping (CLKComplicationTimeTravelDirections)
+                                          -> Void) {
     handler([.forward, .backward])
   }
 
-  func getTimelineStartDate(for complication: CLKComplication, withHandler handler: @escaping (Date?) -> Void) {
+  func getTimelineStartDate(for complication: CLKComplication,
+                            withHandler handler: @escaping (Date?) -> Void) {
     handler(nil)
   }
 
-  func getTimelineEndDate(for complication: CLKComplication, withHandler handler: @escaping (Date?) -> Void) {
+  func getTimelineEndDate(for complication: CLKComplication,
+                          withHandler handler: @escaping (Date?) -> Void) {
     handler(nil)
   }
 
-  func getPrivacyBehavior(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationPrivacyBehavior) -> Void) {
+  func getPrivacyBehavior(for complication: CLKComplication,
+                          withHandler handler: @escaping (CLKComplicationPrivacyBehavior) -> Void) {
     handler(.showOnLockScreen)
   }
 
   // MARK: - Timeline Population
 
-  func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) {
+  func getCurrentTimelineEntry(for complication: CLKComplication,
+                               withHandler handler: @escaping (CLKComplicationTimelineEntry?)
+                                 -> Void) {
     // Call the handler with the current timeline entry
     handler(nil)
   }
 
-  func getTimelineEntries(for complication: CLKComplication, before date: Date, limit: Int, withHandler handler: @escaping ([CLKComplicationTimelineEntry]?) -> Void) {
+  func getTimelineEntries(for complication: CLKComplication,
+                          before date: Date,
+                          limit: Int,
+                          withHandler handler: @escaping ([CLKComplicationTimelineEntry]?)
+                            -> Void) {
     // Call the handler with the timeline entries prior to the given date
     handler(nil)
   }
 
-  func getTimelineEntries(for complication: CLKComplication, after date: Date, limit: Int, withHandler handler: @escaping ([CLKComplicationTimelineEntry]?) -> Void) {
+  func getTimelineEntries(for complication: CLKComplication,
+                          after date: Date,
+                          limit: Int,
+                          withHandler handler: @escaping ([CLKComplicationTimelineEntry]?)
+                            -> Void) {
     // Call the handler with the timeline entries after to the given date
     handler(nil)
   }
 
   // MARK: - Placeholder Templates
 
-  func getLocalizableSampleTemplate(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTemplate?) -> Void) {
+  func getLocalizableSampleTemplate(for complication: CLKComplication,
+                                    withHandler handler: @escaping (CLKComplicationTemplate?)
+                                      -> Void) {
     // This method will be called once per supported complication, and the results will be cached
     handler(nil)
   }

+ 5 - 2
Example/watchOSSample/ServiceExtension/NotificationService.swift

@@ -19,7 +19,9 @@ class NotificationService: UNNotificationServiceExtension {
   var contentHandler: ((UNNotificationContent) -> Void)?
   var bestAttemptContent: UNMutableNotificationContent?
 
-  override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
+  override func didReceive(_ request: UNNotificationRequest,
+                           withContentHandler contentHandler: @escaping (UNNotificationContent)
+                             -> Void) {
     self.contentHandler = contentHandler
     bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
 
@@ -28,7 +30,8 @@ class NotificationService: UNNotificationServiceExtension {
       bestAttemptContent.title = "\(bestAttemptContent.title) 👩‍💻"
 
       // Add images
-      Messaging.serviceExtension().populateNotificationContent(bestAttemptContent, withContentHandler: self.contentHandler!)
+      Messaging.serviceExtension()
+        .populateNotificationContent(bestAttemptContent, withContentHandler: self.contentHandler!)
     }
   }
 

+ 3 - 1
FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp/FiamDisplaySwiftExample/AppDelegate.swift

@@ -19,7 +19,9 @@ import UIKit
 class AppDelegate: UIResponder, UIApplicationDelegate {
   var window: UIWindow?
 
-  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
+  func application(_ application: UIApplication,
+                   didFinishLaunchingWithOptions launchOptions: [UIApplication
+                     .LaunchOptionsKey: Any]?) -> Bool {
     // Override point for customization after application launch.
     return true
   }

+ 10 - 5
FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp/FiamDisplaySwiftExample/BannerMessageViewController.swift

@@ -36,7 +36,8 @@ class BannerMessageViewController: CommonMessageTestVC {
   @IBAction func showRegularBannerTapped(_ sender: Any) {
     verifyLabel.text = "Verification Label"
     let imageRawData = produceImageOfSize(size: CGSize(width: 200, height: 200))
-    let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
+    let fiamImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                imageData: imageRawData!)
 
     let bannerMessage = InAppMessagingBannerDisplay(messageID: "messageId",
                                                     campaignName: "testCampaign",
@@ -71,7 +72,8 @@ class BannerMessageViewController: CommonMessageTestVC {
   @IBAction func showBannerViewWithWideImageTapped(_ sender: Any) {
     verifyLabel.text = "Verification Label"
     let imageRawData = produceImageOfSize(size: CGSize(width: 800, height: 200))
-    let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
+    let fiamImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                imageData: imageRawData!)
 
     let modalMessage = InAppMessagingBannerDisplay(messageID: "messageId",
                                                    campaignName: "testCampaign",
@@ -90,7 +92,8 @@ class BannerMessageViewController: CommonMessageTestVC {
   @IBAction func showBannerViewWithNarrowImageTapped(_ sender: Any) {
     verifyLabel.text = "Verification Label"
     let imageRawData = produceImageOfSize(size: CGSize(width: 200, height: 800))
-    let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
+    let fiamImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                imageData: imageRawData!)
 
     let modalMessage = InAppMessagingBannerDisplay(messageID: "messageId",
                                                    campaignName: "testCampaign",
@@ -109,7 +112,8 @@ class BannerMessageViewController: CommonMessageTestVC {
   @IBAction func showBannerViewWithLargeBodyTextTapped(_ sender: Any) {
     verifyLabel.text = "Verification Label"
     let imageRawData = produceImageOfSize(size: CGSize(width: 200, height: 200))
-    let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
+    let fiamImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                imageData: imageRawData!)
 
     let modalMessage = InAppMessagingBannerDisplay(messageID: "messageId",
                                                    campaignName: "testCampaign",
@@ -128,7 +132,8 @@ class BannerMessageViewController: CommonMessageTestVC {
   @IBAction func showBannerViewWithLongTitleTextTapped(_ sender: Any) {
     verifyLabel.text = "Verification Label"
     let imageRawData = produceImageOfSize(size: CGSize(width: 200, height: 200))
-    let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
+    let fiamImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                imageData: imageRawData!)
 
     let modalMessage = InAppMessagingBannerDisplay(messageID: "messageId",
                                                    campaignName: "testCampaign",

+ 24 - 12
FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp/FiamDisplaySwiftExample/CardMessageViewController.swift

@@ -115,10 +115,12 @@ class CardMessageViewController: CommonMessageTestVC {
 
   @IBAction func showRegularOneButtonWithBothImages(_ sender: Any) {
     let portraitImageRawData = produceImageOfSize(size: CGSize(width: 300, height: 200))
-    let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!)
+    let portraitImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                    imageData: portraitImageRawData!)
 
     let landscapeImageRawData = produceImageOfSize(size: CGSize(width: 200, height: 200))
-    let landscapeImageData = InAppMessagingImageData(imageURL: "url not important", imageData: landscapeImageRawData!)
+    let landscapeImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                     imageData: landscapeImageRawData!)
 
     let cardMessage = TestableCardMessage(
       titleText: normalMessageTitle,
@@ -138,7 +140,8 @@ class CardMessageViewController: CommonMessageTestVC {
 
   @IBAction func showRegularOneButtonWithOnlyPortrait(_ sender: Any) {
     let portraitImageRawData = produceImageOfSize(size: CGSize(width: 300, height: 200))
-    let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!)
+    let portraitImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                    imageData: portraitImageRawData!)
 
     let cardMessage = TestableCardMessage(
       titleText: normalMessageTitle,
@@ -158,10 +161,12 @@ class CardMessageViewController: CommonMessageTestVC {
 
   @IBAction func showRegularTwoButtonWithBothImages(_ sender: Any) {
     let portraitImageRawData = produceImageOfSize(size: CGSize(width: 300, height: 200))
-    let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!)
+    let portraitImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                    imageData: portraitImageRawData!)
 
     let landscapeImageRawData = produceImageOfSize(size: CGSize(width: 300, height: 300))
-    let landscapeImageData = InAppMessagingImageData(imageURL: "url not important", imageData: landscapeImageRawData!)
+    let landscapeImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                     imageData: landscapeImageRawData!)
 
     let cardMessage = TestableCardMessage(
       titleText: normalMessageTitle,
@@ -181,7 +186,8 @@ class CardMessageViewController: CommonMessageTestVC {
 
   @IBAction func showLongTitleRegularBody(_ sender: Any) {
     let portraitImageRawData = produceImageOfSize(size: CGSize(width: 300, height: 200))
-    let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!)
+    let portraitImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                    imageData: portraitImageRawData!)
 
     let cardMessage = TestableCardMessage(
       titleText: longTitleText,
@@ -201,7 +207,8 @@ class CardMessageViewController: CommonMessageTestVC {
 
   @IBAction func showRegularTitleLongBody(_ sender: Any) {
     let portraitImageRawData = produceImageOfSize(size: CGSize(width: 300, height: 200))
-    let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!)
+    let portraitImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                    imageData: portraitImageRawData!)
 
     let cardMessage = TestableCardMessage(
       titleText: normalMessageTitle,
@@ -221,7 +228,8 @@ class CardMessageViewController: CommonMessageTestVC {
 
   @IBAction func showLongTitleNoBody(_ sender: Any) {
     let portraitImageRawData = produceImageOfSize(size: CGSize(width: 300, height: 200))
-    let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!)
+    let portraitImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                    imageData: portraitImageRawData!)
 
     let cardMessage = TestableCardMessage(
       titleText: longTitleText,
@@ -241,7 +249,8 @@ class CardMessageViewController: CommonMessageTestVC {
 
   @IBAction func showLongPrimaryButton(_ sender: Any) {
     let portraitImageRawData = produceImageOfSize(size: CGSize(width: 300, height: 200))
-    let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!)
+    let portraitImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                    imageData: portraitImageRawData!)
 
     let cardMessage = TestableCardMessage(
       titleText: longTitleText,
@@ -261,7 +270,8 @@ class CardMessageViewController: CommonMessageTestVC {
 
   @IBAction func showLongSecondaryButton(_ sender: Any) {
     let portraitImageRawData = produceImageOfSize(size: CGSize(width: 300, height: 200))
-    let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!)
+    let portraitImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                    imageData: portraitImageRawData!)
 
     let cardMessage = TestableCardMessage(
       titleText: longTitleText,
@@ -281,7 +291,8 @@ class CardMessageViewController: CommonMessageTestVC {
 
   @IBAction func showSmallImage(_ sender: Any) {
     let portraitImageRawData = produceImageOfSize(size: CGSize(width: 30, height: 20))
-    let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!)
+    let portraitImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                    imageData: portraitImageRawData!)
 
     let cardMessage = TestableCardMessage(
       titleText: normalMessageTitle,
@@ -301,7 +312,8 @@ class CardMessageViewController: CommonMessageTestVC {
 
   @IBAction func showHugeImage(_ sender: Any) {
     let portraitImageRawData = produceImageOfSize(size: CGSize(width: 3000, height: 2000))
-    let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!)
+    let portraitImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                    imageData: portraitImageRawData!)
 
     let cardMessage = TestableCardMessage(
       titleText: normalMessageTitle,

+ 8 - 5
FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp/FiamDisplaySwiftExample/CommonMessageTestVC.swift

@@ -46,8 +46,10 @@ class CommonMessageTestVC: UIViewController, InAppMessagingDisplayDelegate {
 
   let normalMessageTitle = "Firebase In-App Message title"
   let normalMessageBody = "Firebase In-App Message body"
-  let longBodyText = String(repeating: "This is long message body.", count: 40) + "End of body text."
-  let longTitleText = String(repeating: "This is long message title.", count: 10) + "End of title text."
+  let longBodyText = String(repeating: "This is long message body.", count: 40) +
+    "End of body text."
+  let longTitleText = String(repeating: "This is long message title.", count: 10) +
+    "End of title text."
 
   let startTime = Date().timeIntervalSince1970
   let endTime = Date().timeIntervalSince1970 + 1000
@@ -60,9 +62,10 @@ class CommonMessageTestVC: UIViewController, InAppMessagingDisplayDelegate {
                                                                 buttonTextColor: UIColor.black,
                                                                 backgroundColor: UIColor.yellow)
 
-  let longTextButton = InAppMessagingActionButton(buttonText: "Hakuna matata, it's a wonderful phrase",
-                                                  buttonTextColor: UIColor.black,
-                                                  backgroundColor: UIColor.white)
+  let longTextButton =
+    InAppMessagingActionButton(buttonText: "Hakuna matata, it's a wonderful phrase",
+                               buttonTextColor: UIColor.black,
+                               backgroundColor: UIColor.white)
 
   func produceImageOfSize(size: CGSize) -> Data? {
     let color = UIColor.cyan

+ 10 - 5
FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp/FiamDisplaySwiftExample/ImageOnlyMessageViewController.swift

@@ -35,7 +35,8 @@ class ImageOnlyMessageViewController: CommonMessageTestVC {
   @IBAction func showRegularImageOnlyTapped(_ sender: Any) {
     verifyLabel.text = "Verification Label"
     let imageRawData = produceImageOfSize(size: CGSize(width: 200, height: 200))
-    let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
+    let fiamImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                imageData: imageRawData!)
 
     let modalMessage = InAppMessagingImageOnlyDisplay(messageID: "messageId",
                                                       campaignName: "testCampaign",
@@ -49,7 +50,8 @@ class ImageOnlyMessageViewController: CommonMessageTestVC {
   @IBAction func showImageViewWithLargeImageDimensionTapped(_ sender: Any) {
     verifyLabel.text = "Verification Label"
     let imageRawData = produceImageOfSize(size: CGSize(width: 1000, height: 1000))
-    let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
+    let fiamImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                imageData: imageRawData!)
 
     let modalMessage = InAppMessagingImageOnlyDisplay(messageID: "messageId",
                                                       campaignName: "testCampaign",
@@ -63,7 +65,8 @@ class ImageOnlyMessageViewController: CommonMessageTestVC {
   @IBAction func showImageViewWithWideImage(_ sender: Any) {
     verifyLabel.text = "Verification Label"
     let imageRawData = produceImageOfSize(size: CGSize(width: 1000, height: 100))
-    let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
+    let fiamImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                imageData: imageRawData!)
 
     let modalMessage = InAppMessagingImageOnlyDisplay(messageID: "messageId",
                                                       campaignName: "testCampaign",
@@ -77,7 +80,8 @@ class ImageOnlyMessageViewController: CommonMessageTestVC {
   @IBAction func showImageViewWithNarrowImage(_ sender: Any) {
     verifyLabel.text = "Verification Label"
     let imageRawData = produceImageOfSize(size: CGSize(width: 100, height: 1000))
-    let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
+    let fiamImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                imageData: imageRawData!)
 
     let modalMessage = InAppMessagingImageOnlyDisplay(messageID: "messageId",
                                                       campaignName: "testCampaign",
@@ -90,7 +94,8 @@ class ImageOnlyMessageViewController: CommonMessageTestVC {
 
   @IBAction func showImageViewWithSmallImageDimensionTapped(_ sender: Any) {
     let imageRawData = produceImageOfSize(size: CGSize(width: 50, height: 50))
-    let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
+    let fiamImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                imageData: imageRawData!)
 
     let modalMessage = InAppMessagingImageOnlyDisplay(messageID: "messageId",
                                                       campaignName: "testCampaign",

+ 10 - 5
FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp/FiamDisplaySwiftExample/ModalMessageViewController.swift

@@ -36,7 +36,8 @@ class ModalMessageViewController: CommonMessageTestVC {
   @IBAction func showRegular(_ sender: Any) {
     verifyLabel.text = "Verification Label"
     let imageRawData = produceImageOfSize(size: CGSize(width: 200, height: 200))
-    let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
+    let fiamImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                imageData: imageRawData!)
 
     let modalMessage = InAppMessagingModalDisplay(messageID: "messageId",
                                                   campaignName: "testCampaign",
@@ -73,7 +74,8 @@ class ModalMessageViewController: CommonMessageTestVC {
   @IBAction func showWithoutButton(_ sender: Any) {
     verifyLabel.text = "Verification Label"
     let imageRawData = produceImageOfSize(size: CGSize(width: 200, height: 200))
-    let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
+    let fiamImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                imageData: imageRawData!)
 
     let modalMessage = InAppMessagingModalDisplay(messageID: "messageId",
                                                   campaignName: "testCampaign",
@@ -127,7 +129,8 @@ class ModalMessageViewController: CommonMessageTestVC {
   @IBAction func showWithLargeTitleAndBody(_ sender: Any) {
     verifyLabel.text = "Verification Label"
     let imageRawData = produceImageOfSize(size: CGSize(width: 200, height: 200))
-    let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
+    let fiamImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                imageData: imageRawData!)
 
     let modalMessage = InAppMessagingModalDisplay(messageID: "messageId",
                                                   campaignName: "testCampaign",
@@ -198,7 +201,8 @@ class ModalMessageViewController: CommonMessageTestVC {
   @IBAction func showWithWideImage(_ sender: Any) {
     verifyLabel.text = "Verification Label"
     let imageRawData = produceImageOfSize(size: CGSize(width: 600, height: 200))
-    let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
+    let fiamImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                imageData: imageRawData!)
 
     let modalMessage = InAppMessagingModalDisplay(messageID: "messageId",
                                                   campaignName: "testCampaign",
@@ -218,7 +222,8 @@ class ModalMessageViewController: CommonMessageTestVC {
   @IBAction func showWithThinImage(_ sender: Any) {
     verifyLabel.text = "Verification Label"
     let imageRawData = produceImageOfSize(size: CGSize(width: 200, height: 600))
-    let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
+    let fiamImageData = InAppMessagingImageData(imageURL: "url not important",
+                                                imageData: imageRawData!)
 
     let modalMessage = InAppMessagingModalDisplay(messageID: "messageId",
                                                   campaignName: "testCampaign",

+ 2 - 4
FirebaseStorageSwift/Tests/Integration/StorageIntegration.swift

@@ -551,10 +551,8 @@ class StorageIntegration: XCTestCase {
     })
   }
 
-  private func assertResultSuccess<T>(
-    _ result: Result<T, Error>,
-    file: StaticString = #file, line: UInt = #line
-  ) {
+  private func assertResultSuccess<T>(_ result: Result<T, Error>,
+                                      file: StaticString = #file, line: UInt = #line) {
     switch result {
     case let .success(value):
       XCTAssertNotNil(value, file: file, line: line)

+ 4 - 3
Firestore/Swift/Source/Codable/CollectionReference+WriteEncodable.swift

@@ -33,7 +33,8 @@ extension CollectionReference {
   /// - Returns: A `DocumentReference` pointing to the newly created document.
   public func addDocument<T: Encodable>(from value: T,
                                         encoder: Firestore.Encoder = Firestore.Encoder(),
-                                        completion: ((Error?) -> Void)? = nil) throws -> DocumentReference {
-    return addDocument(data: try encoder.encode(value), completion: completion)
-  }
+                                        completion: ((Error?) -> Void)? = nil) throws
+    -> DocumentReference {
+      return addDocument(data: try encoder.encode(value), completion: completion)
+    }
 }

+ 6 - 3
Firestore/Swift/Source/Codable/Transaction+WriteEncodable.swift

@@ -32,7 +32,8 @@ extension Transaction {
   @discardableResult
   public func setData<T: Encodable>(from value: T,
                                     forDocument doc: DocumentReference,
-                                    encoder: Firestore.Encoder = Firestore.Encoder()) throws -> Transaction {
+                                    encoder: Firestore.Encoder = Firestore
+                                      .Encoder()) throws -> Transaction {
     setData(try encoder.encode(value), forDocument: doc)
     return self
   }
@@ -55,7 +56,8 @@ extension Transaction {
   public func setData<T: Encodable>(from value: T,
                                     forDocument doc: DocumentReference,
                                     merge: Bool,
-                                    encoder: Firestore.Encoder = Firestore.Encoder()) throws -> Transaction {
+                                    encoder: Firestore.Encoder = Firestore
+                                      .Encoder()) throws -> Transaction {
     setData(try encoder.encode(value), forDocument: doc, merge: merge)
     return self
   }
@@ -82,7 +84,8 @@ extension Transaction {
   public func setData<T: Encodable>(from value: T,
                                     forDocument doc: DocumentReference,
                                     mergeFields: [Any],
-                                    encoder: Firestore.Encoder = Firestore.Encoder()) throws -> Transaction {
+                                    encoder: Firestore.Encoder = Firestore
+                                      .Encoder()) throws -> Transaction {
     setData(try encoder.encode(value), forDocument: doc, mergeFields: mergeFields)
     return self
   }

+ 6 - 3
Firestore/Swift/Source/Codable/WriteBatch+WriteEncodable.swift

@@ -32,7 +32,8 @@ extension WriteBatch {
   @discardableResult
   public func setData<T: Encodable>(from value: T,
                                     forDocument doc: DocumentReference,
-                                    encoder: Firestore.Encoder = Firestore.Encoder()) throws -> WriteBatch {
+                                    encoder: Firestore.Encoder = Firestore
+                                      .Encoder()) throws -> WriteBatch {
     setData(try encoder.encode(value), forDocument: doc)
     return self
   }
@@ -55,7 +56,8 @@ extension WriteBatch {
   public func setData<T: Encodable>(from value: T,
                                     forDocument doc: DocumentReference,
                                     merge: Bool,
-                                    encoder: Firestore.Encoder = Firestore.Encoder()) throws -> WriteBatch {
+                                    encoder: Firestore.Encoder = Firestore
+                                      .Encoder()) throws -> WriteBatch {
     setData(try encoder.encode(value), forDocument: doc, merge: merge)
     return self
   }
@@ -82,7 +84,8 @@ extension WriteBatch {
   public func setData<T: Encodable>(from value: T,
                                     forDocument doc: DocumentReference,
                                     mergeFields: [Any],
-                                    encoder: Firestore.Encoder = Firestore.Encoder()) throws -> WriteBatch {
+                                    encoder: Firestore.Encoder = Firestore
+                                      .Encoder()) throws -> WriteBatch {
     setData(try encoder.encode(value), forDocument: doc, mergeFields: mergeFields)
     return self
   }

+ 14 - 6
Firestore/Swift/Tests/Codable/FirestoreEncoderTests.swift

@@ -351,14 +351,16 @@ class FirestoreEncoderTests: XCTestCase {
         let container = try decoder.container(keyedBy: CodingKeys.self)
         try id = container.decode(Int64.self, forKey: .id)
 
-        let nestedContainer = try container.nestedContainer(keyedBy: NestedCodingKeys.self, forKey: .nested)
+        let nestedContainer = try container
+          .nestedContainer(keyedBy: NestedCodingKeys.self, forKey: .nested)
         try name = nestedContainer.decode(String.self, forKey: .name)
       }
 
       func encode(to encoder: Encoder) throws {
         var container = encoder.container(keyedBy: CodingKeys.self)
         try container.encode(id, forKey: .id)
-        var nestedContainer = container.nestedContainer(keyedBy: NestedCodingKeys.self, forKey: .nested)
+        var nestedContainer = container
+          .nestedContainer(keyedBy: NestedCodingKeys.self, forKey: .nested)
         try nestedContainer.encode(name, forKey: .name)
       }
     }
@@ -604,15 +606,20 @@ class FirestoreEncoderTests: XCTestCase {
   #endif // swift(>=5.1)
 }
 
-private func assertThat(_ dictionary: [String: Any], in document: String? = nil, file: StaticString = #file, line: UInt = #line) -> DictionarySubject {
+private func assertThat(_ dictionary: [String: Any],
+                        in document: String? = nil,
+                        file: StaticString = #file,
+                        line: UInt = #line) -> DictionarySubject {
   return DictionarySubject(dictionary, in: document, file: file, line: line)
 }
 
-private func assertThat<X: Equatable & Codable>(_ model: X, file: StaticString = #file, line: UInt = #line) -> CodableSubject<X> {
+private func assertThat<X: Equatable & Codable>(_ model: X, file: StaticString = #file,
+                                                line: UInt = #line) -> CodableSubject<X> {
   return CodableSubject(model, file: file, line: line)
 }
 
-private func assertThat<X: Equatable & Encodable>(_ model: X, file: StaticString = #file, line: UInt = #line) -> EncodableSubject<X> {
+private func assertThat<X: Equatable & Encodable>(_ model: X, file: StaticString = #file,
+                                                  line: UInt = #line) -> EncodableSubject<X> {
   return EncodableSubject(model, file: file, line: line)
 }
 
@@ -708,7 +715,8 @@ private class DictionarySubject {
   }
 
   func failsDecoding<X: Equatable & Codable>(to _: X.Type) -> Void {
-    XCTAssertThrowsError(try Firestore.Decoder().decode(X.self, from: subject), file: file, line: line)
+    XCTAssertThrowsError(try Firestore.Decoder().decode(X.self, from: subject), file: file,
+                         line: line)
   }
 }
 

+ 10 - 5
Firestore/Swift/Tests/Integration/CodableIntegrationTests.swift

@@ -45,11 +45,14 @@ class CodableIntegrationTests: FSTIntegrationTestCase {
       }
     case .writeBatch:
       if let merge = merge {
-        try doc.firestore.batch().setData(from: value, forDocument: doc, merge: merge).commit(completion: completion)
+        try doc.firestore.batch().setData(from: value, forDocument: doc, merge: merge)
+          .commit(completion: completion)
       } else if let mergeFields = mergeFields {
-        try doc.firestore.batch().setData(from: value, forDocument: doc, mergeFields: mergeFields).commit(completion: completion)
+        try doc.firestore.batch().setData(from: value, forDocument: doc, mergeFields: mergeFields)
+          .commit(completion: completion)
       } else {
-        try doc.firestore.batch().setData(from: value, forDocument: doc).commit(completion: completion)
+        try doc.firestore.batch().setData(from: value, forDocument: doc)
+          .commit(completion: completion)
       }
     case .transaction:
       doc.firestore.runTransaction({ (transaction, errorPointer) -> Any? in
@@ -270,11 +273,13 @@ class CodableIntegrationTests: FSTIntegrationTestCase {
 
       let newUpdate = Model(name: "xxxx", age: 10, hobby: "Play")
       // Note 'name' is not updated.
-      try setData(from: newUpdate, forDocument: docToWrite, withFlavor: flavor, mergeFields: ["age", FieldPath(["hobby"])])
+      try setData(from: newUpdate, forDocument: docToWrite, withFlavor: flavor,
+                  mergeFields: ["age", FieldPath(["hobby"])])
 
       readAfterUpdate = try readDocument(forRef: docToWrite).data(as: Model.self)
       XCTAssertEqual(readAfterUpdate!, Model(name: "test",
-                                             age: 10, hobby: "Play"), "Failed with flavor \(flavor)")
+                                             age: 10,
+                                             hobby: "Play"), "Failed with flavor \(flavor)")
     }
   }
 

+ 103 - 36
Firestore/third_party/FirestoreEncoder/FirestoreDecoder.swift

@@ -18,7 +18,8 @@ import Foundation
 
 extension Firestore {
   public struct Decoder {
-    fileprivate static let documentRefUserInfoKey = CodingUserInfoKey(rawValue: "DocumentRefUserInfoKey")
+    fileprivate static let documentRefUserInfoKey =
+      CodingUserInfoKey(rawValue: "DocumentRefUserInfoKey")
 
     public init() {}
     /// Returns an instance of specified type from a Firestore document.
@@ -93,7 +94,8 @@ class _FirestoreDecoder: Decoder {
     }
 
     guard let topContainer = storage.topContainer as? [String: Any] else {
-      let context = DecodingError.Context(codingPath: codingPath, debugDescription: "Not a dictionary")
+      let context = DecodingError
+        .Context(codingPath: codingPath, debugDescription: "Not a dictionary")
       throw DecodingError.typeMismatch([String: Any].self, context)
     }
 
@@ -368,7 +370,8 @@ private struct _FirestoreKeyedDecodingContainer<K: CodingKey>: KeyedDecodingCont
     }
 
     let description = "No value associated with key \(key) (\"\(key.stringValue)\")."
-    let context = DecodingError.Context(codingPath: decoder.codingPath, debugDescription: description)
+    let context = DecodingError
+      .Context(codingPath: decoder.codingPath, debugDescription: description)
     throw DecodingError.keyNotFound(key, context)
   }
 
@@ -382,7 +385,9 @@ private struct _FirestoreKeyedDecodingContainer<K: CodingKey>: KeyedDecodingCont
     throw DecodingError.valueNotFound(T.self, context)
   }
 
-  public func nestedContainer<NestedKey>(keyedBy _: NestedKey.Type, forKey key: Key) throws -> KeyedDecodingContainer<NestedKey> {
+  public func nestedContainer<NestedKey>(keyedBy _: NestedKey.Type,
+                                         forKey key: Key) throws
+    -> KeyedDecodingContainer<NestedKey> {
     decoder.codingPath.append(key)
     defer { self.decoder.codingPath.removeLast() }
 
@@ -393,10 +398,12 @@ private struct _FirestoreKeyedDecodingContainer<K: CodingKey>: KeyedDecodingCont
     }
 
     guard let dictionary = value as? [String: Any] else {
-      throw DecodingError._typeMismatch(at: codingPath, expectation: [String: Any].self, reality: value)
+      throw DecodingError
+        ._typeMismatch(at: codingPath, expectation: [String: Any].self, reality: value)
     }
 
-    let container = _FirestoreKeyedDecodingContainer<NestedKey>(referencing: decoder, wrapping: dictionary)
+    let container = _FirestoreKeyedDecodingContainer<NestedKey>(referencing: decoder,
+                                                                wrapping: dictionary)
     return KeyedDecodingContainer(container)
   }
 
@@ -631,7 +638,8 @@ private struct _FirestoreUnkeyedDecodingContainer: UnkeyedDecodingContainer {
     return try require(value: decoded)
   }
 
-  public mutating func nestedContainer<NestedKey>(keyedBy _: NestedKey.Type) throws -> KeyedDecodingContainer<NestedKey> {
+  public mutating func nestedContainer<NestedKey>(keyedBy _: NestedKey
+    .Type) throws -> KeyedDecodingContainer<NestedKey> {
     decoder.codingPath.append(_FirestoreKey(index: currentIndex))
     defer { self.decoder.codingPath.removeLast() }
 
@@ -641,11 +649,13 @@ private struct _FirestoreUnkeyedDecodingContainer: UnkeyedDecodingContainer {
     try requireNotNSNull(value)
 
     guard let dictionary = value as? [String: Any] else {
-      throw DecodingError._typeMismatch(at: codingPath, expectation: [String: Any].self, reality: value)
+      throw DecodingError
+        ._typeMismatch(at: codingPath, expectation: [String: Any].self, reality: value)
     }
 
     currentIndex += 1
-    let container = _FirestoreKeyedDecodingContainer<NestedKey>(referencing: decoder, wrapping: dictionary)
+    let container = _FirestoreKeyedDecodingContainer<NestedKey>(referencing: decoder,
+                                                                wrapping: dictionary)
     return KeyedDecodingContainer(container)
   }
 
@@ -679,7 +689,12 @@ private struct _FirestoreUnkeyedDecodingContainer: UnkeyedDecodingContainer {
 
   private func expectNotAtEnd() throws {
     guard !isAtEnd else {
-      throw DecodingError.valueNotFound(Any?.self, DecodingError.Context(codingPath: decoder.codingPath + [_FirestoreKey(index: currentIndex)], debugDescription: "Unkeyed container is at end."))
+      throw DecodingError
+        .valueNotFound(Any?.self,
+                       DecodingError
+                         .Context(codingPath: decoder
+                           .codingPath + [_FirestoreKey(index: currentIndex)],
+                                  debugDescription: "Unkeyed container is at end."))
     }
   }
 
@@ -696,7 +711,9 @@ private struct _FirestoreUnkeyedDecodingContainer: UnkeyedDecodingContainer {
   private mutating func require<T>(value: T?) throws -> T {
     guard let value = value else {
       let message = "Expected \(T.self) value but found null instead."
-      let context = DecodingError.Context(codingPath: decoder.codingPath + [_FirestoreKey(index: currentIndex)], debugDescription: message)
+      let context = DecodingError
+        .Context(codingPath: decoder.codingPath + [_FirestoreKey(index: currentIndex)],
+                 debugDescription: message)
       throw DecodingError.valueNotFound(T.self, context)
     }
 
@@ -710,7 +727,11 @@ extension _FirestoreDecoder: SingleValueDecodingContainer {
 
   private func expectNonNull<T>(_ type: T.Type) throws {
     guard !decodeNil() else {
-      throw DecodingError.valueNotFound(type, DecodingError.Context(codingPath: codingPath, debugDescription: "Expected \(type) but found null value instead."))
+      throw DecodingError
+        .valueNotFound(type,
+                       DecodingError
+                         .Context(codingPath: codingPath,
+                                  debugDescription: "Expected \(type) but found null value instead."))
     }
   }
 
@@ -814,13 +835,17 @@ extension _FirestoreDecoder {
   func unbox(_ value: Any, as type: Int.Type) throws -> Int? {
     guard !(value is NSNull) else { return nil }
 
-    guard let number = value as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
+    guard let number = value as? NSNumber, number !== kCFBooleanTrue,
+      number !== kCFBooleanFalse else {
       throw DecodingError._typeMismatch(at: codingPath, expectation: type, reality: value)
     }
 
     let int = number.intValue
     guard NSNumber(value: int) == number else {
-      throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath, debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
+      throw DecodingError
+        .dataCorrupted(DecodingError
+          .Context(codingPath: codingPath,
+                   debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
     }
 
     return int
@@ -829,13 +854,17 @@ extension _FirestoreDecoder {
   func unbox(_ value: Any, as type: Int8.Type) throws -> Int8? {
     guard !(value is NSNull) else { return nil }
 
-    guard let number = value as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
+    guard let number = value as? NSNumber, number !== kCFBooleanTrue,
+      number !== kCFBooleanFalse else {
       throw DecodingError._typeMismatch(at: codingPath, expectation: type, reality: value)
     }
 
     let int8 = number.int8Value
     guard NSNumber(value: int8) == number else {
-      throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath, debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
+      throw DecodingError
+        .dataCorrupted(DecodingError
+          .Context(codingPath: codingPath,
+                   debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
     }
 
     return int8
@@ -844,13 +873,17 @@ extension _FirestoreDecoder {
   func unbox(_ value: Any, as type: Int16.Type) throws -> Int16? {
     guard !(value is NSNull) else { return nil }
 
-    guard let number = value as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
+    guard let number = value as? NSNumber, number !== kCFBooleanTrue,
+      number !== kCFBooleanFalse else {
       throw DecodingError._typeMismatch(at: codingPath, expectation: type, reality: value)
     }
 
     let int16 = number.int16Value
     guard NSNumber(value: int16) == number else {
-      throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath, debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
+      throw DecodingError
+        .dataCorrupted(DecodingError
+          .Context(codingPath: codingPath,
+                   debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
     }
 
     return int16
@@ -859,13 +892,17 @@ extension _FirestoreDecoder {
   func unbox(_ value: Any, as type: Int32.Type) throws -> Int32? {
     guard !(value is NSNull) else { return nil }
 
-    guard let number = value as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
+    guard let number = value as? NSNumber, number !== kCFBooleanTrue,
+      number !== kCFBooleanFalse else {
       throw DecodingError._typeMismatch(at: codingPath, expectation: type, reality: value)
     }
 
     let int32 = number.int32Value
     guard NSNumber(value: int32) == number else {
-      throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath, debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
+      throw DecodingError
+        .dataCorrupted(DecodingError
+          .Context(codingPath: codingPath,
+                   debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
     }
 
     return int32
@@ -874,13 +911,17 @@ extension _FirestoreDecoder {
   func unbox(_ value: Any, as type: Int64.Type) throws -> Int64? {
     guard !(value is NSNull) else { return nil }
 
-    guard let number = value as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
+    guard let number = value as? NSNumber, number !== kCFBooleanTrue,
+      number !== kCFBooleanFalse else {
       throw DecodingError._typeMismatch(at: codingPath, expectation: type, reality: value)
     }
 
     let int64 = number.int64Value
     guard NSNumber(value: int64) == number else {
-      throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath, debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
+      throw DecodingError
+        .dataCorrupted(DecodingError
+          .Context(codingPath: codingPath,
+                   debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
     }
 
     return int64
@@ -889,13 +930,17 @@ extension _FirestoreDecoder {
   func unbox(_ value: Any, as type: UInt.Type) throws -> UInt? {
     guard !(value is NSNull) else { return nil }
 
-    guard let number = value as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
+    guard let number = value as? NSNumber, number !== kCFBooleanTrue,
+      number !== kCFBooleanFalse else {
       throw DecodingError._typeMismatch(at: codingPath, expectation: type, reality: value)
     }
 
     let uint = number.uintValue
     guard NSNumber(value: uint) == number else {
-      throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath, debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
+      throw DecodingError
+        .dataCorrupted(DecodingError
+          .Context(codingPath: codingPath,
+                   debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
     }
 
     return uint
@@ -904,13 +949,17 @@ extension _FirestoreDecoder {
   func unbox(_ value: Any, as type: UInt8.Type) throws -> UInt8? {
     guard !(value is NSNull) else { return nil }
 
-    guard let number = value as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
+    guard let number = value as? NSNumber, number !== kCFBooleanTrue,
+      number !== kCFBooleanFalse else {
       throw DecodingError._typeMismatch(at: codingPath, expectation: type, reality: value)
     }
 
     let uint8 = number.uint8Value
     guard NSNumber(value: uint8) == number else {
-      throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath, debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
+      throw DecodingError
+        .dataCorrupted(DecodingError
+          .Context(codingPath: codingPath,
+                   debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
     }
 
     return uint8
@@ -919,13 +968,17 @@ extension _FirestoreDecoder {
   func unbox(_ value: Any, as type: UInt16.Type) throws -> UInt16? {
     guard !(value is NSNull) else { return nil }
 
-    guard let number = value as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
+    guard let number = value as? NSNumber, number !== kCFBooleanTrue,
+      number !== kCFBooleanFalse else {
       throw DecodingError._typeMismatch(at: codingPath, expectation: type, reality: value)
     }
 
     let uint16 = number.uint16Value
     guard NSNumber(value: uint16) == number else {
-      throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath, debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
+      throw DecodingError
+        .dataCorrupted(DecodingError
+          .Context(codingPath: codingPath,
+                   debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
     }
 
     return uint16
@@ -934,13 +987,17 @@ extension _FirestoreDecoder {
   func unbox(_ value: Any, as type: UInt32.Type) throws -> UInt32? {
     guard !(value is NSNull) else { return nil }
 
-    guard let number = value as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
+    guard let number = value as? NSNumber, number !== kCFBooleanTrue,
+      number !== kCFBooleanFalse else {
       throw DecodingError._typeMismatch(at: codingPath, expectation: type, reality: value)
     }
 
     let uint32 = number.uint32Value
     guard NSNumber(value: uint32) == number else {
-      throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath, debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
+      throw DecodingError
+        .dataCorrupted(DecodingError
+          .Context(codingPath: codingPath,
+                   debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
     }
 
     return uint32
@@ -949,13 +1006,17 @@ extension _FirestoreDecoder {
   func unbox(_ value: Any, as type: UInt64.Type) throws -> UInt64? {
     guard !(value is NSNull) else { return nil }
 
-    guard let number = value as? NSNumber, number !== kCFBooleanTrue, number !== kCFBooleanFalse else {
+    guard let number = value as? NSNumber, number !== kCFBooleanTrue,
+      number !== kCFBooleanFalse else {
       throw DecodingError._typeMismatch(at: codingPath, expectation: type, reality: value)
     }
 
     let uint64 = number.uint64Value
     guard NSNumber(value: uint64) == number else {
-      throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath, debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
+      throw DecodingError
+        .dataCorrupted(DecodingError
+          .Context(codingPath: codingPath,
+                   debugDescription: "Decoded number <\(number)> does not fit in \(type)."))
     }
 
     return uint64
@@ -973,7 +1034,10 @@ extension _FirestoreDecoder {
       // * If it was a Double or Decimal, you will get back the nearest approximation if it will fit
       let double = number.doubleValue
       guard abs(double) <= Double(Float.greatestFiniteMagnitude) else {
-        throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: codingPath, debugDescription: "Decoded number \(number) does not fit in \(type)."))
+        throw DecodingError
+          .dataCorrupted(DecodingError
+            .Context(codingPath: codingPath,
+                     debugDescription: "Decoded number \(number) does not fit in \(type)."))
       }
 
       return Float(double)
@@ -1078,15 +1142,18 @@ extension _FirestoreDecoder {
 }
 
 extension DecodingError {
-  static func _typeMismatch(at path: [CodingKey], expectation: Any.Type, reality: Any) -> DecodingError {
-    let description = "Expected to decode \(expectation) but found \(_typeDescription(of: reality)) instead."
+  static func _typeMismatch(at path: [CodingKey], expectation: Any.Type,
+                            reality: Any) -> DecodingError {
+    let description =
+      "Expected to decode \(expectation) but found \(_typeDescription(of: reality)) instead."
     return .typeMismatch(expectation, Context(codingPath: path, debugDescription: description))
   }
 
   fileprivate static func _typeDescription(of value: Any) -> String {
     if value is NSNull {
       return "a null value"
-    } else if value is NSNumber /* FIXME: If swift-corelibs-foundation isn't updated to use NSNumber, this check will be necessary: || value is Int || value is Double */ {
+    }
+      else if value is NSNumber /* FIXME: If swift-corelibs-foundation isn't updated to use NSNumber, this check will be necessary: || value is Int || value is Double */ {
       return "a number"
     } else if value is String {
       return "a string/data"

+ 97 - 30
Firestore/third_party/FirestoreEncoder/FirestoreEncoder.swift

@@ -40,7 +40,11 @@ extension Firestore {
       // encoded directly.
       guard T.self != DocumentReference.self,
         T.self != FieldValue.self else {
-        throw EncodingError.invalidValue(value, EncodingError.Context(codingPath: [], debugDescription: "Top-level \(T.self) is not allowed."))
+        throw EncodingError
+          .invalidValue(value,
+                        EncodingError
+                          .Context(codingPath: [],
+                                   debugDescription: "Top-level \(T.self) is not allowed."))
       }
       guard let topLevel = try _FirestoreEncoder().box_(value) else {
         throw EncodingError.invalidValue(value,
@@ -105,7 +109,8 @@ private class _FirestoreEncoder: Encoder {
       topContainer = container
     }
 
-    let container = _FirestoreKeyedEncodingContainer<Key>(referencing: self, codingPath: codingPath, wrapping: topContainer)
+    let container = _FirestoreKeyedEncodingContainer<Key>(referencing: self, codingPath: codingPath,
+                                                          wrapping: topContainer)
     return KeyedEncodingContainer(container)
   }
 
@@ -123,7 +128,8 @@ private class _FirestoreEncoder: Encoder {
       topContainer = container
     }
 
-    return _FirestoreUnkeyedEncodingContainer(referencing: self, codingPath: codingPath, wrapping: topContainer)
+    return _FirestoreUnkeyedEncodingContainer(referencing: self, codingPath: codingPath,
+                                              wrapping: topContainer)
   }
 
   public func singleValueContainer() -> SingleValueEncodingContainer {
@@ -189,7 +195,9 @@ private struct _FirestoreKeyedEncodingContainer<K: CodingKey>: KeyedEncodingCont
   // MARK: - Initialization
 
   /// Initializes `self` with the given references.
-  fileprivate init(referencing encoder: _FirestoreEncoder, codingPath: [CodingKey], wrapping container: NSMutableDictionary) {
+  fileprivate init(referencing encoder: _FirestoreEncoder,
+                   codingPath: [CodingKey],
+                   wrapping container: NSMutableDictionary) {
     self.encoder = encoder
     self.codingPath = codingPath
     self.container = container
@@ -198,20 +206,61 @@ private struct _FirestoreKeyedEncodingContainer<K: CodingKey>: KeyedEncodingCont
   // MARK: - KeyedEncodingContainerProtocol Methods
 
   public mutating func encodeNil(forKey key: Key) throws { container[key.stringValue] = NSNull() }
-  public mutating func encode(_ value: Bool, forKey key: Key) throws { container[key.stringValue] = encoder.box(value) }
-  public mutating func encode(_ value: Int, forKey key: Key) throws { container[key.stringValue] = encoder.box(value) }
-  public mutating func encode(_ value: Int8, forKey key: Key) throws { container[key.stringValue] = encoder.box(value) }
-  public mutating func encode(_ value: Int16, forKey key: Key) throws { container[key.stringValue] = encoder.box(value) }
-  public mutating func encode(_ value: Int32, forKey key: Key) throws { container[key.stringValue] = encoder.box(value) }
-  public mutating func encode(_ value: Int64, forKey key: Key) throws { container[key.stringValue] = encoder.box(value) }
-  public mutating func encode(_ value: UInt, forKey key: Key) throws { container[key.stringValue] = encoder.box(value) }
-  public mutating func encode(_ value: UInt8, forKey key: Key) throws { container[key.stringValue] = encoder.box(value) }
-  public mutating func encode(_ value: UInt16, forKey key: Key) throws { container[key.stringValue] = encoder.box(value) }
-  public mutating func encode(_ value: UInt32, forKey key: Key) throws { container[key.stringValue] = encoder.box(value) }
-  public mutating func encode(_ value: UInt64, forKey key: Key) throws { container[key.stringValue] = encoder.box(value) }
-  public mutating func encode(_ value: String, forKey key: Key) throws { container[key.stringValue] = encoder.box(value) }
-  public mutating func encode(_ value: Float, forKey key: Key) throws { container[key.stringValue] = encoder.box(value) }
-  public mutating func encode(_ value: Double, forKey key: Key) throws { container[key.stringValue] = encoder.box(value) }
+  public mutating func encode(_ value: Bool, forKey key: Key) throws {
+    container[key.stringValue] = encoder.box(value)
+  }
+
+  public mutating func encode(_ value: Int, forKey key: Key) throws {
+    container[key.stringValue] = encoder.box(value)
+  }
+
+  public mutating func encode(_ value: Int8, forKey key: Key) throws {
+    container[key.stringValue] = encoder.box(value)
+  }
+
+  public mutating func encode(_ value: Int16, forKey key: Key) throws {
+    container[key.stringValue] = encoder.box(value)
+  }
+
+  public mutating func encode(_ value: Int32, forKey key: Key) throws {
+    container[key.stringValue] = encoder.box(value)
+  }
+
+  public mutating func encode(_ value: Int64, forKey key: Key) throws {
+    container[key.stringValue] = encoder.box(value)
+  }
+
+  public mutating func encode(_ value: UInt, forKey key: Key) throws {
+    container[key.stringValue] = encoder.box(value)
+  }
+
+  public mutating func encode(_ value: UInt8, forKey key: Key) throws {
+    container[key.stringValue] = encoder.box(value)
+  }
+
+  public mutating func encode(_ value: UInt16, forKey key: Key) throws {
+    container[key.stringValue] = encoder.box(value)
+  }
+
+  public mutating func encode(_ value: UInt32, forKey key: Key) throws {
+    container[key.stringValue] = encoder.box(value)
+  }
+
+  public mutating func encode(_ value: UInt64, forKey key: Key) throws {
+    container[key.stringValue] = encoder.box(value)
+  }
+
+  public mutating func encode(_ value: String, forKey key: Key) throws {
+    container[key.stringValue] = encoder.box(value)
+  }
+
+  public mutating func encode(_ value: Float, forKey key: Key) throws {
+    container[key.stringValue] = encoder.box(value)
+  }
+
+  public mutating func encode(_ value: Double, forKey key: Key) throws {
+    container[key.stringValue] = encoder.box(value)
+  }
 
   public mutating func encode<T: Encodable>(_ value: T, forKey key: Key) throws {
     #if compiler(>=5.1)
@@ -228,7 +277,9 @@ private struct _FirestoreKeyedEncodingContainer<K: CodingKey>: KeyedEncodingCont
     container[key.stringValue] = try encoder.box(value)
   }
 
-  public mutating func nestedContainer<NestedKey>(keyedBy _: NestedKey.Type, forKey key: Key) -> KeyedEncodingContainer<NestedKey> {
+  public mutating func nestedContainer<NestedKey>(keyedBy _: NestedKey.Type,
+                                                  forKey key: Key)
+    -> KeyedEncodingContainer<NestedKey> {
     let dictionary = NSMutableDictionary()
     self.container[key.stringValue] = dictionary
 
@@ -237,7 +288,9 @@ private struct _FirestoreKeyedEncodingContainer<K: CodingKey>: KeyedEncodingCont
       codingPath.removeLast()
     }
 
-    let container = _FirestoreKeyedEncodingContainer<NestedKey>(referencing: encoder, codingPath: codingPath, wrapping: dictionary)
+    let container = _FirestoreKeyedEncodingContainer<NestedKey>(referencing: encoder,
+                                                                codingPath: codingPath,
+                                                                wrapping: dictionary)
     return KeyedEncodingContainer(container)
   }
 
@@ -249,11 +302,13 @@ private struct _FirestoreKeyedEncodingContainer<K: CodingKey>: KeyedEncodingCont
     defer {
       codingPath.removeLast()
     }
-    return _FirestoreUnkeyedEncodingContainer(referencing: encoder, codingPath: codingPath, wrapping: array)
+    return _FirestoreUnkeyedEncodingContainer(referencing: encoder, codingPath: codingPath,
+                                              wrapping: array)
   }
 
   public mutating func superEncoder() -> Encoder {
-    return _FirestoreReferencingEncoder(referencing: encoder, at: _FirestoreKey.super, wrapping: container)
+    return _FirestoreReferencingEncoder(referencing: encoder, at: _FirestoreKey.super,
+                                        wrapping: container)
   }
 
   public mutating func superEncoder(forKey key: Key) -> Encoder {
@@ -281,7 +336,9 @@ private struct _FirestoreUnkeyedEncodingContainer: UnkeyedEncodingContainer {
   // MARK: - Initialization
 
   /// Initializes `self` with the given references.
-  fileprivate init(referencing encoder: _FirestoreEncoder, codingPath: [CodingKey], wrapping container: NSMutableArray) {
+  fileprivate init(referencing encoder: _FirestoreEncoder,
+                   codingPath: [CodingKey],
+                   wrapping container: NSMutableArray) {
     self.encoder = encoder
     self.codingPath = codingPath
     self.container = container
@@ -312,7 +369,8 @@ private struct _FirestoreUnkeyedEncodingContainer: UnkeyedEncodingContainer {
     container.add(try encoder.box(value))
   }
 
-  public mutating func nestedContainer<NestedKey>(keyedBy _: NestedKey.Type) -> KeyedEncodingContainer<NestedKey> {
+  public mutating func nestedContainer<NestedKey>(keyedBy _: NestedKey
+    .Type) -> KeyedEncodingContainer<NestedKey> {
     codingPath.append(_FirestoreKey(index: count))
     defer {
       self.codingPath.removeLast()
@@ -321,7 +379,9 @@ private struct _FirestoreUnkeyedEncodingContainer: UnkeyedEncodingContainer {
     let dictionary = NSMutableDictionary()
     self.container.add(dictionary)
 
-    let container = _FirestoreKeyedEncodingContainer<NestedKey>(referencing: encoder, codingPath: codingPath, wrapping: dictionary)
+    let container = _FirestoreKeyedEncodingContainer<NestedKey>(referencing: encoder,
+                                                                codingPath: codingPath,
+                                                                wrapping: dictionary)
     return KeyedEncodingContainer(container)
   }
 
@@ -333,11 +393,13 @@ private struct _FirestoreUnkeyedEncodingContainer: UnkeyedEncodingContainer {
 
     let array = NSMutableArray()
     container.add(array)
-    return _FirestoreUnkeyedEncodingContainer(referencing: encoder, codingPath: codingPath, wrapping: array)
+    return _FirestoreUnkeyedEncodingContainer(referencing: encoder, codingPath: codingPath,
+                                              wrapping: array)
   }
 
   public mutating func superEncoder() -> Encoder {
-    return _FirestoreReferencingEncoder(referencing: encoder, at: container.count, wrapping: container)
+    return _FirestoreReferencingEncoder(referencing: encoder, at: container.count,
+                                        wrapping: container)
   }
 }
 
@@ -424,7 +486,8 @@ extension _FirestoreEncoder: SingleValueEncodingContainer {
   // MARK: - SingleValueEncodingContainer Methods
 
   private func assertCanEncodeNewValue() {
-    precondition(shouldAllocateNewContainer, "Attempt to encode value through single value container when previously value already encoded.")
+    precondition(shouldAllocateNewContainer,
+                 "Attempt to encode value through single value container when previously value already encoded.")
   }
 
   public func encodeNil() throws {
@@ -535,7 +598,9 @@ private class _FirestoreReferencingEncoder: _FirestoreEncoder {
   // MARK: - Initialization
 
   /// Initializes `self` by referencing the given array container in the given encoder.
-  fileprivate init(referencing encoder: _FirestoreEncoder, at index: Int, wrapping array: NSMutableArray) {
+  fileprivate init(referencing encoder: _FirestoreEncoder,
+                   at index: Int,
+                   wrapping array: NSMutableArray) {
     self.encoder = encoder
     reference = .array(array, index)
     super.init()
@@ -545,7 +610,9 @@ private class _FirestoreReferencingEncoder: _FirestoreEncoder {
   }
 
   /// Initializes `self` by referencing the given dictionary container in the given encoder.
-  fileprivate init(referencing encoder: _FirestoreEncoder, at key: CodingKey, wrapping dictionary: NSMutableDictionary) {
+  fileprivate init(referencing encoder: _FirestoreEncoder,
+                   at key: CodingKey,
+                   wrapping dictionary: NSMutableDictionary) {
     self.encoder = encoder
     reference = .dictionary(dictionary, key.stringValue)
     super.init()

+ 7 - 3
GoogleDataTransport/GDTTestApp/app.swift

@@ -24,13 +24,16 @@ import GoogleDataTransport
   class AppDelegate: UIResponder, UIApplicationDelegate {
     var window: UIWindow?
 
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
+    func application(_ application: UIApplication,
+                     didFinishLaunchingWithOptions launchOptions: [UIApplication
+                       .LaunchOptionsKey: Any]?) -> Bool {
       return true
     }
   }
 
   public class ViewController: UIViewController {
-    let transport: GDTCORTransport = GDTCORTransport(mappingID: "1234", transformers: nil, target: GDTCORTarget.test.rawValue)!
+    let transport: GDTCORTransport = GDTCORTransport(mappingID: "1234", transformers: nil,
+                                                     target: GDTCORTarget.test.rawValue)!
   }
 
 // macOS specifics.
@@ -44,6 +47,7 @@ import GoogleDataTransport
   }
 
   public class ViewController: NSViewController {
-    let transport: GDTCORTransport = GDTCORTransport(mappingID: "1234", transformers: nil, target: GDTCORTarget.test.rawValue)!
+    let transport: GDTCORTransport = GDTCORTransport(mappingID: "1234", transformers: nil,
+                                                     target: GDTCORTarget.test.rawValue)!
   }
 #endif

+ 4 - 2
GoogleDataTransport/GDTTestApp/gdthelpers.swift

@@ -19,14 +19,16 @@ import GoogleDataTransport
 // For use by GDT.
 class TestDataObject: NSObject, GDTCOREventDataObject {
   func transportBytes() -> Data {
-    return "Normally, some SDK's data object would populate this. \(Date())".data(using: String.Encoding.utf8)!
+    return "Normally, some SDK's data object would populate this. \(Date())"
+      .data(using: String.Encoding.utf8)!
   }
 }
 
 class TestPrioritizer: NSObject, GDTCORPrioritizer {
   func prioritizeEvent(_ event: GDTCOREvent) {}
 
-  func uploadPackage(with target: GDTCORTarget, conditions: GDTCORUploadConditions) -> GDTCORUploadPackage {
+  func uploadPackage(with target: GDTCORTarget,
+                     conditions: GDTCORUploadConditions) -> GDTCORUploadPackage {
     return GDTCORUploadPackage(target: GDTCORTarget.test)
   }
 }

+ 15 - 7
GoogleDataTransportCCTSupport/GDTCCTTestApp/app.swift

@@ -24,15 +24,20 @@ import GoogleDataTransport
   class AppDelegate: UIResponder, UIApplicationDelegate {
     var window: UIWindow?
 
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
+    func application(_ application: UIApplication,
+                     didFinishLaunchingWithOptions launchOptions: [UIApplication
+                       .LaunchOptionsKey: Any]?) -> Bool {
       return true
     }
   }
 
   public class ViewController: UIViewController {
-    let cctTransport: GDTCORTransport = GDTCORTransport(mappingID: "1018", transformers: nil, target: GDTCORTarget.CCT.rawValue)!
-    let fllTransport: GDTCORTransport = GDTCORTransport(mappingID: "1018", transformers: nil, target: GDTCORTarget.FLL.rawValue)!
-    let cshTransport: GDTCORTransport = GDTCORTransport(mappingID: "1018", transformers: nil, target: GDTCORTarget.CSH.rawValue)!
+    let cctTransport: GDTCORTransport = GDTCORTransport(mappingID: "1018", transformers: nil,
+                                                        target: GDTCORTarget.CCT.rawValue)!
+    let fllTransport: GDTCORTransport = GDTCORTransport(mappingID: "1018", transformers: nil,
+                                                        target: GDTCORTarget.FLL.rawValue)!
+    let cshTransport: GDTCORTransport = GDTCORTransport(mappingID: "1018", transformers: nil,
+                                                        target: GDTCORTarget.CSH.rawValue)!
 
     @IBOutlet var backendSwitch: UISegmentedControl?
 
@@ -92,9 +97,12 @@ import GoogleDataTransport
   }
 
   public class ViewController: NSViewController {
-    let cctTransport: GDTCORTransport = GDTCORTransport(mappingID: "1018", transformers: nil, target: GDTCORTarget.CCT.rawValue)!
-    let fllTransport: GDTCORTransport = GDTCORTransport(mappingID: "1018", transformers: nil, target: GDTCORTarget.FLL.rawValue)!
-    let cshTransport: GDTCORTransport = GDTCORTransport(mappingID: "1018", transformers: nil, target: GDTCORTarget.CSH.rawValue)!
+    let cctTransport: GDTCORTransport = GDTCORTransport(mappingID: "1018", transformers: nil,
+                                                        target: GDTCORTarget.CCT.rawValue)!
+    let fllTransport: GDTCORTransport = GDTCORTransport(mappingID: "1018", transformers: nil,
+                                                        target: GDTCORTarget.FLL.rawValue)!
+    let cshTransport: GDTCORTransport = GDTCORTransport(mappingID: "1018", transformers: nil,
+                                                        target: GDTCORTarget.CSH.rawValue)!
 
     @IBOutlet var backendSwitch: NSSegmentedControl?
 

+ 4 - 2
Metrics/Sources/MetricsLib/UploadMetrics.swift

@@ -56,7 +56,8 @@ public struct TableUpdate: Encodable {
   }
 
   /// Creates a table update for code coverage by parsing a coverage report from XCov.
-  public static func createFrom(coverage: CoverageReport, pullRequest: Int, currentTime: String) -> TableUpdate {
+  public static func createFrom(coverage: CoverageReport, pullRequest: Int,
+                                currentTime: String) -> TableUpdate {
     var metrics = [[String]]()
     for target in coverage.targets {
       if TARGETS_TO_COLLECT.contains(target.name) {
@@ -71,6 +72,7 @@ public struct TableUpdate: Encodable {
       }
     }
     let columnNames = ["product_name", "pull_request_id", "coverage_total", "collection_time"]
-    return TableUpdate(table_name: "IosCodeCoverage", column_names: columnNames, replace_measurements: metrics)
+    return TableUpdate(table_name: "IosCodeCoverage", column_names: columnNames,
+                       replace_measurements: metrics)
   }
 }

+ 6 - 3
Metrics/Tests/MetricsTests/UploadMetricsTests.swift

@@ -26,7 +26,8 @@ final class UploadMetricsTests: XCTestCase {
     let target_one = Target(name: "Auth_Example_iOS.app", coverage: 0.1)
     let target_two = Target(name: "Core_Example_iOS.app", coverage: 0.2)
     let report = CoverageReport(targets: [target_one, target_two], coverage: 0.15)
-    let metricsUpdate = TableUpdate.createFrom(coverage: report, pullRequest: PULL_REQUEST, currentTime: CURRENT_TIME)
+    let metricsUpdate = TableUpdate
+      .createFrom(coverage: report, pullRequest: PULL_REQUEST, currentTime: CURRENT_TIME)
     XCTAssertEqual(metricsUpdate.table_name, TABLE_NAME)
     XCTAssertEqual(metricsUpdate.replace_measurements.count, 2)
     XCTAssertEqual(metricsUpdate.replace_measurements[0],
@@ -38,7 +39,8 @@ final class UploadMetricsTests: XCTestCase {
   func testShouldIgnoreUnkownTargets() {
     let target = Target(name: "Unknown_Target", coverage: 0.3)
     let report = CoverageReport(targets: [target], coverage: 0.15)
-    let metrics = TableUpdate.createFrom(coverage: report, pullRequest: PULL_REQUEST, currentTime: CURRENT_TIME)
+    let metrics = TableUpdate
+      .createFrom(coverage: report, pullRequest: PULL_REQUEST, currentTime: CURRENT_TIME)
     XCTAssertEqual(metrics.table_name, TABLE_NAME)
     XCTAssertEqual(metrics.replace_measurements.count, 0)
   }
@@ -49,6 +51,7 @@ final class UploadMetricsTests: XCTestCase {
                             replace_measurements: [["0"], ["test"]])
     let metrics = UploadMetrics(tables: [table])
     let json = try metrics.json()
-    XCTAssertEqual(json, "{\"tables\":[{\"replace_measurements\":[[\"0\"],[\"test\"]],\"column_names\":[\"col\"],\"table_name\":\"name\"}]}")
+    XCTAssertEqual(json,
+                   "{\"tables\":[{\"replace_measurements\":[[\"0\"],[\"test\"]],\"column_names\":[\"col\"],\"table_name\":\"name\"}]}")
   }
 }

+ 10 - 5
ZipBuilder/Sources/ZipBuilder/CocoaPodUtils.swift

@@ -199,7 +199,8 @@ enum CocoaPodUtils {
         currentPod = pod.trimmingCharacters(in: quotes)
         pods[currentPod!] = version
       } else if let currentPod = currentPod {
-        let matches = depRegex.matches(in: line, range: NSRange(location: 0, length: line.utf8.count))
+        let matches = depRegex
+          .matches(in: line, range: NSRange(location: 0, length: line.utf8.count))
         // Match something like - GTMSessionFetcher/Full (= 1.3.0)
         if let match = matches.first {
           let depLine = (line as NSString).substring(with: match.range(at: 0)) as String
@@ -323,7 +324,8 @@ enum CocoaPodUtils {
   /// Get all transitive pod dependencies for a pod.
   /// - Returns: An array of dependencies with versions for a given pod.
   static func transitiveVersionedPodDependencies(for podName: String,
-                                                 in installedPods: [String: PodInfo]) -> [VersionedPod] {
+                                                 in installedPods: [String: PodInfo])
+    -> [VersionedPod] {
     return transitivePodDependencies(for: podName, in: installedPods).map {
       CocoaPodUtils.VersionedPod(name: $0, version: installedPods[$0]?.version)
     }
@@ -341,7 +343,8 @@ enum CocoaPodUtils {
   /// - Parameters:
   ///   - input: A line entry from Podfile.lock.
   /// - Returns: A tuple of the framework and version, if it can be parsed.
-  private static func detectVersion(fromLine input: String) -> (framework: String, version: String)? {
+  private static func detectVersion(fromLine input: String)
+    -> (framework: String, version: String)? {
     // Get the components of the line to parse them individually. Ignore any whitespace only Strings.
     let components = input.components(separatedBy: " ").filter { !$0.isEmpty }
 
@@ -405,7 +408,8 @@ enum CocoaPodUtils {
       podfile += "  pod '\(pod.name)'"
       // Check if we want to use a local version of the podspec.
       if let localURL = LaunchArgs.shared.localPodspecPath,
-        FileManager.default.fileExists(atPath: localURL.appendingPathComponent(pod.name + ".podspec").path) {
+        FileManager.default
+        .fileExists(atPath: localURL.appendingPathComponent(pod.name + ".podspec").path) {
         podfile += ", :path => '\(localURL.path)'"
       } else if let podVersion = pod.version {
         podfile += ", '\(podVersion)'"
@@ -453,7 +457,8 @@ enum CocoaPodUtils {
 
     // Generate the full path of the Podfile and attempt to write it to disk.
     let path = directory.appendingPathComponent("Podfile")
-    let podfile = generatePodfile(for: pods, customSpecsRepos: customSpecRepos, forceStaticLibs: forceStaticLibs)
+    let podfile = generatePodfile(for: pods, customSpecsRepos: customSpecRepos,
+                                  forceStaticLibs: forceStaticLibs)
     do {
       try podfile.write(toFile: path.path, atomically: true, encoding: .utf8)
     } catch {

+ 2 - 1
ZipBuilder/Sources/ZipBuilder/FirebaseBuilder.swift

@@ -102,7 +102,8 @@ struct FirebaseBuilder {
       } else {
         // Move zip to parent directory so it doesn't get removed with other artifacts.
         let parentLocation =
-          zipped.deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent(zipped.lastPathComponent)
+          zipped.deletingLastPathComponent().deletingLastPathComponent()
+            .appendingPathComponent(zipped.lastPathComponent)
         // Clear out the output file if it exists.
         FileManager.default.removeIfExists(at: parentLocation)
         do {

+ 28 - 14
ZipBuilder/Sources/ZipBuilder/FrameworkBuilder.swift

@@ -112,9 +112,11 @@ struct FrameworkBuilder {
 
     // Build the full cached framework path.
     let realFramework = frameworkBuildName(podName)
-    let cachedFrameworkDir = cachedFrameworkRoot.appendingPathComponent("\(realFramework).xcframework")
+    let cachedFrameworkDir = cachedFrameworkRoot
+      .appendingPathComponent("\(realFramework).xcframework")
     let cachedCarthageDir = cachedCarthageRoot.appendingPathComponent("\(realFramework).framework")
-    let (frameworkDir, carthageDir) = compileFrameworkAndResources(withName: podName, podInfo: podInfo)
+    let (frameworkDir, carthageDir) = compileFrameworkAndResources(withName: podName,
+                                                                   podInfo: podInfo)
     do {
       // Remove the previously cached framework if it exists, otherwise the `moveItem` call will
       // fail.
@@ -149,7 +151,8 @@ struct FrameworkBuilder {
   /// This runs a command and immediately returns a Shell result.
   /// NOTE: This exists in conjunction with the `Shell.execute...` due to issues with different
   ///       `.bash_profile` environment variables. This should be consolidated in the future.
-  private func syncExec(command: String, args: [String] = [], captureOutput: Bool = false) -> Shell.Result {
+  private func syncExec(command: String, args: [String] = [], captureOutput: Bool = false) -> Shell
+    .Result {
     let task = Process()
     task.launchPath = command
     task.arguments = args
@@ -241,7 +244,8 @@ struct FrameworkBuilder {
     let distributionFlag = carthageBuild ? "-DFIREBASE_BUILD_CARTHAGE" : "-DFIREBASE_BUILD_ZIP_FILE"
     let platformSpecificFlags = platform.otherCFlags().joined(separator: " ")
     let cFlags = "OTHER_CFLAGS=$(value) \(distributionFlag) \(platformSpecificFlags)"
-    let cleanArch = isMacCatalyst ? Architecture.x86_64.rawValue : archs.map { $0.rawValue }.joined(separator: " ")
+    let cleanArch = isMacCatalyst ? Architecture.x86_64.rawValue : archs.map { $0.rawValue }
+      .joined(separator: " ")
 
     var args = ["build",
                 "-configuration", "release",
@@ -302,7 +306,8 @@ struct FrameworkBuilder {
       var actualFramework: String
       do {
         let files = try FileManager.default.contentsOfDirectory(at: frameworkPath,
-                                                                includingPropertiesForKeys: nil).compactMap { $0.path }
+                                                                includingPropertiesForKeys: nil)
+          .compactMap { $0.path }
         let frameworkDir = files.filter { $0.contains(".framework") }
         actualFramework = URL(fileURLWithPath: frameworkDir[0]).lastPathComponent
       } catch {
@@ -310,7 +315,8 @@ struct FrameworkBuilder {
       }
       var libPath = frameworkPath.appendingPathComponent(actualFramework)
       if !LaunchArgs.shared.dynamic {
-        libPath = libPath.appendingPathComponent(actualFramework.replacingOccurrences(of: ".framework", with: ""))
+        libPath = libPath
+          .appendingPathComponent(actualFramework.replacingOccurrences(of: ".framework", with: ""))
       }
       print("buildThin returns \(libPath)")
       return libPath
@@ -410,7 +416,8 @@ struct FrameworkBuilder {
 
     print("About to create xcframework for \(frameworkDir.path) with \(inputArgs)")
 
-    let result = syncExec(command: "/usr/bin/xcodebuild", args: ["-create-xcframework", "-output", frameworkDir.path] + inputArgs)
+    let result = syncExec(command: "/usr/bin/xcodebuild",
+                          args: ["-create-xcframework", "-output", frameworkDir.path] + inputArgs)
     switch result {
     case let .error(code, output):
       fatalError("""
@@ -449,7 +456,8 @@ struct FrameworkBuilder {
     }
 
     // Find the location of the public headers.
-    let anyArch = LaunchArgs.shared.archs[0] // any arch is ok, but need to make sure we're building it
+    let anyArch = LaunchArgs.shared
+      .archs[0] // any arch is ok, but need to make sure we're building it
     let archivePath = thinArchives[anyArch]!
     let headersDir = archivePath.deletingLastPathComponent().appendingPathComponent("Headers")
 
@@ -463,7 +471,8 @@ struct FrameworkBuilder {
       var umbrellaHeaderURL: URL
       do {
         let files = try fileManager.contentsOfDirectory(at: headersDir,
-                                                        includingPropertiesForKeys: nil).compactMap { $0.path }
+                                                        includingPropertiesForKeys: nil)
+          .compactMap { $0.path }
         let umbrellas = files.filter { $0.hasSuffix("umbrella.h") }
         if umbrellas.count != 1 {
           fatalError("Did not find exactly one umbrella header in \(headersDir).")
@@ -645,7 +654,8 @@ struct FrameworkBuilder {
       let moduleDir = frameworkDir.appendingPathComponent("Modules").resolvingSymlinksInPath()
       do {
         let files = try fileManager.contentsOfDirectory(at: moduleDir,
-                                                        includingPropertiesForKeys: nil).compactMap { $0.path }
+                                                        includingPropertiesForKeys: nil)
+          .compactMap { $0.path }
         let swiftModules = files.filter { $0.hasSuffix(".swiftmodule") }
         if swiftModules.isEmpty {
           return false
@@ -659,15 +669,18 @@ struct FrameworkBuilder {
           do {
             try fileManager.copyItem(at: moduleDir, to: destModuleDir)
           } catch {
-            fatalError("Could not copy Modules from \(moduleDir) to " + "\(destModuleDir): \(error)")
+            fatalError("Could not copy Modules from \(moduleDir) to " +
+              "\(destModuleDir): \(error)")
           }
         } else {
           // If the Modules directory is already there, only copy in the architecture specific files
           // from the *.swiftmodule subdirectory.
           do {
             let files = try fileManager.contentsOfDirectory(at: swiftModule,
-                                                            includingPropertiesForKeys: nil).compactMap { $0.path }
-            let destSwiftModuleDir = destModuleDir.appendingPathComponent(swiftModule.lastPathComponent)
+                                                            includingPropertiesForKeys: nil)
+              .compactMap { $0.path }
+            let destSwiftModuleDir = destModuleDir
+              .appendingPathComponent(swiftModule.lastPathComponent)
             for file in files {
               let fileURL = URL(fileURLWithPath: file)
               let projectDir = swiftModule.appendingPathComponent("Project")
@@ -676,7 +689,8 @@ struct FrameworkBuilder {
                 // The Project directory (introduced with Xcode 11.4) already exist, only copy in
                 // new contents.
                 let projectFiles = try fileManager.contentsOfDirectory(at: projectDir,
-                                                                       includingPropertiesForKeys: nil).compactMap { $0.path }
+                                                                       includingPropertiesForKeys: nil)
+                  .compactMap { $0.path }
                 let destProjectDir = destSwiftModuleDir.appendingPathComponent("Project")
                 for projectFile in projectFiles {
                   let projectFileURL = URL(fileURLWithPath: projectFile)

+ 5 - 2
ZipBuilder/Sources/ZipBuilder/ModuleMapBuilder.swift

@@ -87,7 +87,9 @@ struct ModuleMapBuilder {
     var installedPods: [String: FrameworkInfo] = [:]
     for pod in selectedPods {
       let versionedPod = CocoaPodUtils.VersionedPod(name: pod.key, version: pod.value.version)
-      installedPods[pod.key] = FrameworkInfo(isSourcePod: pod.value.isSourcePod, versionedPod: versionedPod, subspecs: pod.value.subspecs)
+      installedPods[pod.key] = FrameworkInfo(isSourcePod: pod.value.isSourcePod,
+                                             versionedPod: versionedPod,
+                                             subspecs: pod.value.subspecs)
     }
     self.installedPods = installedPods
   }
@@ -120,7 +122,8 @@ struct ModuleMapBuilder {
     let xcconfigFile = projectDir.appendingPathComponents(["Pods", "Target Support Files",
                                                            "Pods-FrameworkMaker",
                                                            "Pods-FrameworkMaker.release.xcconfig"])
-    allPods[podName]?.moduleMapContents = makeModuleMap(forFramework: framework, withXcconfigFile: xcconfigFile)
+    allPods[podName]?
+      .moduleMapContents = makeModuleMap(forFramework: framework, withXcconfigFile: xcconfigFile)
   }
 
   /// Convert a list of versioned pods to a list of versioned pods specified with all needed subspecs.

+ 3 - 1
ZipBuilder/Sources/ZipBuilder/ResourcesManager.swift

@@ -189,7 +189,9 @@ extension ResourcesManager {
   static func removeEmptyResourcesDirectories(in dir: URL) {
     // Find all the Resources directories to begin with.
     let fileManager = FileManager.default
-    guard let resourceDirs = try? fileManager.recursivelySearch(for: .directories(name: "Resources"), in: dir) else {
+    guard let resourceDirs = try? fileManager
+      .recursivelySearch(for: .directories(name: "Resources"),
+                         in: dir) else {
       print("Attempted to remove empty resource directories, but it failed. This shouldn't be " +
         "classified as an error, but something to look out for.")
       return

+ 31 - 20
ZipBuilder/Sources/ZipBuilder/ZipBuilder.swift

@@ -195,7 +195,8 @@ struct ZipBuilder {
       return CocoaPodUtils.VersionedPod(name: name, version: version)
     }
 
-    let (installedPods, frameworks, carthageFrameworks) = buildAndAssembleZip(podsToInstall: podsToInstall)
+    let (installedPods, frameworks,
+         carthageFrameworks) = buildAndAssembleZip(podsToInstall: podsToInstall)
 
     // We need the Firebase pod to get the version for Carthage and to copy the `Firebase.h` and
     // `module.modulemap` file from it.
@@ -204,14 +205,20 @@ struct ZipBuilder {
         "installed: \(installedPods)")
     }
 
-    let zipDir = try assembleDistributions(inProjectDir: projectDir, withPackageKind: "Firebase",
-                                           podsToInstall: podsToInstall, installedPods: installedPods,
-                                           frameworksToAssemble: frameworks, firebasePod: firebasePod)
+    let zipDir = try assembleDistributions(inProjectDir: projectDir,
+                                           withPackageKind: "Firebase",
+                                           podsToInstall: podsToInstall,
+                                           installedPods: installedPods,
+                                           frameworksToAssemble: frameworks,
+                                           firebasePod: firebasePod)
     var carthageDir: URL?
     if let carthageFrameworks = carthageFrameworks {
-      carthageDir = try assembleDistributions(inProjectDir: projectDir, withPackageKind: "CarthageFirebase",
-                                              podsToInstall: podsToInstall, installedPods: installedPods,
-                                              frameworksToAssemble: carthageFrameworks, firebasePod: firebasePod)
+      carthageDir = try assembleDistributions(inProjectDir: projectDir,
+                                              withPackageKind: "CarthageFirebase",
+                                              podsToInstall: podsToInstall,
+                                              installedPods: installedPods,
+                                              frameworksToAssemble: carthageFrameworks,
+                                              firebasePod: firebasePod)
     }
 
     return ReleaseArtifacts(firebaseVersion: firebasePod.version,
@@ -310,7 +317,8 @@ struct ZipBuilder {
           for file in ["upload-symbols", "run"] {
             let source = pod.value.installedLocation.appendingPathComponent(file)
 
-            let target = zipDir.appendingPathComponent(crashlyticsPodName).appendingPathComponent(file)
+            let target = zipDir.appendingPathComponent(crashlyticsPodName)
+              .appendingPathComponent(file)
             do {
               try FileManager.default.copyItem(at: source, to: target)
             } catch {
@@ -402,7 +410,8 @@ struct ZipBuilder {
 
         let destination = dir.appendingPathComponent(xcframeworkName)
         try fileManager.copyItem(at: xcframework, to: destination)
-        copiedFrameworkNames.append(xcframeworkName.replacingOccurrences(of: ".xcframework", with: ""))
+        copiedFrameworkNames
+          .append(xcframeworkName.replacingOccurrences(of: ".xcframework", with: ""))
       }
     }
 
@@ -529,14 +538,13 @@ struct ZipBuilder {
   /// - Returns: The product directory containing all frameworks and the names of the frameworks
   ///            that were copied for this subspec.
   @discardableResult
-  func installAndCopyFrameworks(
-    forPod podName: String,
-    withInstalledPods installedPods: [String: CocoaPodUtils.PodInfo],
-    projectDir: URL,
-    rootZipDir: URL,
-    builtFrameworks: [String: [URL]],
-    podsToIgnore: [String] = []
-  ) throws -> (productDir: URL, frameworks: [String]) {
+  func installAndCopyFrameworks(forPod podName: String,
+                                withInstalledPods installedPods: [String: CocoaPodUtils.PodInfo],
+                                projectDir: URL,
+                                rootZipDir: URL,
+                                builtFrameworks: [String: [URL]],
+                                podsToIgnore: [String] = []) throws -> (productDir: URL,
+                                                                        frameworks: [String]) {
     let podsToCopy = [podName] +
       CocoaPodUtils.transitiveMasterPodDependencies(for: podName, in: installedPods)
     // Copy the frameworks into the proper product directory.
@@ -545,7 +553,8 @@ struct ZipBuilder {
                                              toDirectory: productDir,
                                              frameworkLocations: builtFrameworks,
                                              podsToIgnore: podsToIgnore,
-                                             foldersToIgnore: FirebasePods.duplicateFrameworksToRemove(pod: podName))
+                                             foldersToIgnore: FirebasePods
+                                               .duplicateFrameworksToRemove(pod: podName))
 
     let copiedFrameworks = namedFrameworks.filter {
       // Only return the frameworks that aren't contained in the "podsToIgnore" array, aren't an
@@ -655,7 +664,8 @@ struct ZipBuilder {
   /// frameworks to install EXCLUDING resources, as they are handled later (if not included in the
   /// .framework file already).
   private func generateFrameworks(fromPods pods: [String: CocoaPodUtils.PodInfo],
-                                  inProjectDir projectDir: URL) -> ([String: [URL]], [String: [URL]]?) {
+                                  inProjectDir projectDir: URL) -> ([String: [URL]],
+                                                                    [String: [URL]]?) {
     // Verify the Pods folder exists and we can get the contents of it.
     let fileManager = FileManager.default
 
@@ -689,7 +699,8 @@ struct ZipBuilder {
         let builder = FrameworkBuilder(projectDir: projectDir)
         let (framework, carthageFramework) = builder.buildFramework(withName: podName,
                                                                     podInfo: podInfo,
-                                                                    logsOutputDir: paths.logsOutputDir)
+                                                                    logsOutputDir: paths
+                                                                      .logsOutputDir)
 
         frameworks = [framework]
         if let carthageFramework = carthageFramework {

+ 2 - 0
scripts/style.sh

@@ -97,6 +97,8 @@ swift_disable=(
 swift_options=(
   # Mimic Objective-C style.
   --indent 2
+  --maxwidth 100
+  --wrapparameters afterfirst
 
   --disable $(join , "${swift_disable[@]}")
 )