Skip to content

Commit 9540ac1

Browse files
authored
Merge pull request #590 from redcapua/update-to-Swift-4.2
Update to swift 4.2
2 parents ef448ff + 7adce14 commit 9540ac1

File tree

49 files changed

+3584
-197
lines changed

Some content is hidden

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

49 files changed

+3584
-197
lines changed

abtesting/ABTestingExample.xcodeproj/project.pbxproj

Lines changed: 115 additions & 12 deletions
Large diffs are not rendered by default.

abtesting/ABTestingExample/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2222

2323
var window: UIWindow?
2424

25-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
25+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
2626
FirebaseApp.configure()
2727
return true
2828
}

abtesting/ABTestingExample/ViewController.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,13 @@ class ViewController: UIViewController, UITableViewDataSource {
8787
}
8888

8989
@objc func printInstanceIDToken() {
90-
let instanceID = InstanceID.instanceID().token() ?? "null"
91-
print("InstanceID token: \(instanceID)")
90+
InstanceID.instanceID().instanceID { (result, error) in
91+
if let error = error {
92+
print("Error fetching remote instange ID: \(error)")
93+
} else if let result = result {
94+
print("Remote instance ID token: \(result.token)")
95+
}
96+
}
9297
}
9398

9499
deinit {
@@ -104,7 +109,7 @@ class ViewController: UIViewController, UITableViewDataSource {
104109
navigationController?.navigationBar.barTintColor = ViewController.lightColors.primary
105110
navigationController?.navigationBar.barStyle = .`default`
106111
navigationController?.navigationBar.titleTextAttributes = [
107-
NSAttributedStringKey.foregroundColor: UIColor.black
112+
NSAttributedString.Key.foregroundColor: UIColor.black
108113
]
109114
tableView.separatorColor = .gray
110115
tableView.backgroundColor = UIColor(red: 0.94, green: 0.94, blue: 0.94, alpha: 1)
@@ -113,7 +118,7 @@ class ViewController: UIViewController, UITableViewDataSource {
113118
navigationController?.navigationBar.barTintColor = ViewController.darkColors.primary
114119
navigationController?.navigationBar.barStyle = .black
115120
navigationController?.navigationBar.titleTextAttributes = [
116-
NSAttributedStringKey.foregroundColor: UIColor.white
121+
NSAttributedString.Key.foregroundColor: UIColor.white
117122
]
118123
tableView.separatorColor = .lightGray
119124
tableView.backgroundColor = ViewController.darkColors.secondary

admob/AdMobExample.xcodeproj/project.pbxproj

Lines changed: 211 additions & 24 deletions
Large diffs are not rendered by default.

admob/AdMobExampleSwift/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2626

2727
var window: UIWindow?
2828

29-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
29+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
3030
// Use Firebase library to configure APIs
3131
FirebaseApp.configure()
3232
return true

analytics/AnalyticsExample.xcodeproj/project.pbxproj

Lines changed: 158 additions & 7 deletions
Large diffs are not rendered by default.

analytics/AnalyticsExampleSwift/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2222

2323
var window: UIWindow?
2424

25-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
25+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
2626

2727
// [START tracker_swift]
2828
FirebaseApp.configure()

authentication/AuthenticationExample.xcodeproj/project.pbxproj

Lines changed: 280 additions & 5 deletions
Large diffs are not rendered by default.

authentication/AuthenticationExampleSwift/AppDelegate.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, GIDSignInDelegate {
3535
var window: UIWindow?
3636

3737
func application(_ application: UIApplication, didFinishLaunchingWithOptions
38-
launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
38+
launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
3939
// [START firebase_configure]
4040
// Use Firebase library to configure APIs
4141
FirebaseApp.configure()
@@ -59,13 +59,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate, GIDSignInDelegate {
5959

6060
// [START new_delegate]
6161
@available(iOS 9.0, *)
62-
func application(_ application: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any])
62+
func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any])
6363
-> Bool {
6464
// [END new_delegate]
6565
return self.application(application,
6666
open: url,
6767
// [START new_options]
68-
sourceApplication:options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String,
68+
sourceApplication:options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
6969
annotation: [:])
7070
}
7171
// [END new_options]
@@ -89,7 +89,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, GIDSignInDelegate {
8989
}
9090
// [END old_options]
9191

92-
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
92+
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
9393
return userActivity.webpageURL.flatMap(handlePasswordlessSignIn)!
9494
}
9595

@@ -100,7 +100,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, GIDSignInDelegate {
100100
// [END is_signin_link]
101101
UserDefaults.standard.set(link, forKey: "Link")
102102
(window?.rootViewController as? UINavigationController)?.popToRootViewController(animated: false)
103-
window?.rootViewController?.childViewControllers[0].performSegue(withIdentifier: "passwordless", sender: nil)
103+
window?.rootViewController?.children[0].performSegue(withIdentifier: "passwordless", sender: nil)
104104
return true
105105
}
106106
return false

authentication/AuthenticationExampleSwift/MainViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,15 +432,15 @@ class MainViewController: UITableViewController, GIDSignInUIDelegate {
432432
return "Unlink"
433433
}
434434

435-
override func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCellEditingStyle {
435+
override func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle {
436436
if indexPath.section == kSectionProviders {
437437
return .delete
438438
}
439439
return .none
440440
}
441441

442442
// Swipe to delete
443-
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
443+
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
444444
if editingStyle == .delete {
445445
let providerID = Auth.auth().currentUser?.providerData[indexPath.row].providerID
446446
showSpinner({

0 commit comments

Comments
 (0)