Skip to content

Auto-style swift sources #847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ before_install:
- bundle exec pod install --project-directory=Example --repo-update
- bundle exec pod install --project-directory=Firestore/Example --no-repo-update
- brew install clang-format
- brew install swiftformat
- brew install cmake
- brew install go # Somehow the build for Abseil requires this.
- echo "$TRAVIS_COMMIT_RANGE"
Expand Down
2 changes: 0 additions & 2 deletions Example/tvOSSample/tvOSSample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import FirebaseCore

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
Expand All @@ -26,4 +25,3 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return true
}
}

27 changes: 8 additions & 19 deletions Example/tvOSSample/tvOSSample/AuthLoginViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,14 @@ import UIKit
import FirebaseAuth

class AuthLoginViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}

// Do any additional setup after loading the view.
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
6 changes: 3 additions & 3 deletions Example/tvOSSample/tvOSSample/AuthViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ class AuthViewController: UIViewController {
// MARK: - User Interface

/// A stackview containing all of the buttons to providers (Email, OAuth, etc).
@IBOutlet weak var providers: UIStackView!
@IBOutlet var providers: UIStackView!

/// A stackview containing a signed in label and sign out button.
@IBOutlet weak var signedIn: UIStackView!
@IBOutlet var signedIn: UIStackView!

/// A label to display the status for the signed in user.
@IBOutlet weak var signInStatus: UILabel!
@IBOutlet var signInStatus: UILabel!

// MARK: - User Actions

Expand Down
4 changes: 2 additions & 2 deletions Example/tvOSSample/tvOSSample/DatabaseViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DatabaseViewController: UIViewController {
// MARK: - Interface

/// Label to display the current value.
@IBOutlet weak var currentValue: UILabel!
@IBOutlet var currentValue: UILabel!

// MARK: - User Actions

Expand Down Expand Up @@ -65,7 +65,7 @@ class DatabaseViewController: UIViewController {
// Observe the current value, and update the UI every time it changes.
let ref = Database.database().reference(withPath: Constants.databasePath)

ref.observe(.value) { [weak self] (snapshot) in
ref.observe(.value) { [weak self] snapshot in
guard let value = snapshot.value as? Int else {
print("Error grabbing value from Snapshot!")
return
Expand Down
9 changes: 5 additions & 4 deletions Example/tvOSSample/tvOSSample/EmailLoginViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ protocol EmailLoginDelegate {
func emailLogin(_ controller: EmailLoginViewController, signedInAs user: User)
func emailLogin(_ controller: EmailLoginViewController, failedWithError error: Error)
}

class EmailLoginViewController: UIViewController {

// MARK: - Public Properties
Expand All @@ -27,15 +28,15 @@ class EmailLoginViewController: UIViewController {

// MARK: - User Interface

@IBOutlet private weak var emailAddress: UITextField!
@IBOutlet private weak var password: UITextField!
@IBOutlet private var emailAddress: UITextField!
@IBOutlet private var password: UITextField!

// MARK: - User Actions

@IBAction func logInButtonHit(_ sender: UIButton) {
guard let (email, password) = validatedInputs() else { return }

Auth.auth().signIn(withEmail: email, password: password) { [unowned self] (user, error) in
Auth.auth().signIn(withEmail: email, password: password) { [unowned self] user, error in
guard let user = user else {
print("Error signing in: \(error!)")
self.delegate?.emailLogin(self, failedWithError: error!)
Expand All @@ -50,7 +51,7 @@ class EmailLoginViewController: UIViewController {
@IBAction func signUpButtonHit(_ sender: UIButton) {
guard let (email, password) = validatedInputs() else { return }

Auth.auth().createUser(withEmail: email, password: password) { [unowned self] (user, error) in
Auth.auth().createUser(withEmail: email, password: password) { [unowned self] user, error in
guard let user = user else {
print("Error signing up: \(error!)")
self.delegate?.emailLogin(self, failedWithError: error!)
Expand Down
16 changes: 8 additions & 8 deletions Example/tvOSSample/tvOSSample/StorageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ 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
Expand All @@ -52,16 +52,16 @@ class StorageViewController: UIViewController {
// MARK: Interface

/// Image view to display the downloaded image.
@IBOutlet weak var imageView: UIImageView!
@IBOutlet var imageView: UIImageView!

/// The download button.
@IBOutlet weak var downloadButton: UIButton!
@IBOutlet var downloadButton: UIButton!

/// The clear button.
@IBOutlet weak var clearButton: UIButton!
@IBOutlet var clearButton: UIButton!

/// A visual representation of the state.
@IBOutlet weak var stateLabel: UILabel!
@IBOutlet var stateLabel: UILabel!

// MARK: - User Actions

Expand All @@ -72,7 +72,7 @@ class StorageViewController: UIViewController {
let storage = Storage.storage()
let ref = storage.reference(withPath: Constants.downloadPath)
// TODO: Show progress bar here using proper API.
let task = ref.getData(maxSize: Constants.maxSize) { [unowned self] (data, error) in
let task = ref.getData(maxSize: Constants.maxSize) { [unowned self] data, error in
guard let data = data else {
self.state = .failed("Error downloading: \(error!.localizedDescription)")
return
Expand Down Expand Up @@ -114,7 +114,7 @@ class StorageViewController: UIViewController {
stateLabel.text = "State: Downloading..."

// Download complete, ensure the download button is still off and enable the clear button.
case (_, .downloaded(let image)):
case let (_, .downloaded(image)):
imageView.image = image
stateLabel.text = "State: Image downloaded!"

Expand All @@ -124,7 +124,7 @@ class StorageViewController: UIViewController {
stateLabel.text = "State: Pending download"

// An error occurred.
case (_, .failed(let error)):
case let (_, .failed(error)):
stateLabel.text = "State: \(error)"

// For now, as the default, throw a fatal error because it's an unexpected state. This will
Expand Down
Loading