Skip to content
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

Update code style to common Swift style #125

Merged
merged 7 commits into from
Apr 17, 2017
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
7 changes: 7 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
disabled_rules:
opt_in_rules:
included:
- ../Sources
- .
excluded:

Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@
F56289141C3BE3A20082D9A6 /* Frameworks */,
F56289151C3BE3A20082D9A6 /* Headers */,
F56289161C3BE3A20082D9A6 /* Resources */,
0AA2E1E11E9F54E0007B6FEC /* Swiftlint */,
);
buildRules = (
);
Expand Down Expand Up @@ -386,6 +387,23 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
0AA2E1E11E9F54E0007B6FEC /* Swiftlint */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = Swiftlint;
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\n swiftlint lint --config ../.swiftlint.yml\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
F547D4A81C3BEA8F0075A0C2 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
// Copyright 2016 Skyscanner Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
// Unless required by applicable law or agreed to in writing, software distributed under the
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions
// and limitations under the License.

import UIKit

Expand All @@ -13,80 +18,72 @@ 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 {

// MARK: - Appearance

if #available(iOS 9.0, *) {

// Apply styles for text fields contained in AppearanceViewController
let styles = SkyFloatingLabelTextField.appearance(whenContainedInInstancesOf: [AppearanceViewController.self])

let styles = SkyFloatingLabelTextField.appearance(
whenContainedInInstancesOf: [AppearanceViewController.self]
)

// Text-, placeholder- and tintcolor
styles.textColor = UIColor.brown
styles.tintColor = UIColor.brown
styles.placeholderColor = UIColor.darkGray
styles.selectedTitleColor = UIColor.orange
styles.errorColor = UIColor.purple
styles.textColor = .brown
styles.tintColor = .brown
styles.placeholderColor = .darkGray
styles.selectedTitleColor = .orange
styles.errorColor = .purple

// Fonts
styles.font = UIFont.systemFont(ofSize: 14, weight: 1.0)
styles.placeholderFont = UIFont.systemFont(ofSize: 14, weight: 0.1)
styles.font = .systemFont(ofSize: 14, weight: 1.0)
styles.placeholderFont = .systemFont(ofSize: 14, weight: 0.1)

// Line
styles.lineHeight = 2
styles.lineColor = UIColor.brown
styles.lineColor = .brown

// Selected line
styles.selectedLineHeight = 3
styles.selectedLineColor = UIColor.orange
styles.selectedLineColor = .orange
}

// MARK: - Icon appearance

if #available(iOS 9.0, *) {

// Apply icon styles
let iconStyles = SkyFloatingLabelTextFieldWithIcon.appearance(whenContainedInInstancesOf: [AppearanceViewController.self])

let iconStyles = SkyFloatingLabelTextFieldWithIcon.appearance(
whenContainedInInstancesOf: [AppearanceViewController.self]
)

// Icon colors
iconStyles.iconColor = UIColor.brown
iconStyles.selectedIconColor = UIColor.orange
iconStyles.iconColor = .brown
iconStyles.selectedIconColor = .orange

// Icon font
iconStyles.iconFont = UIFont(name: "FontAwesome", size: 15)

// Icon margins
iconStyles.iconMarginLeft = 5
iconStyles.iconMarginBottom = 5
}

return true
}

func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
return true
}

func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillResignActive(_ application: UIApplication) { }

func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidEnterBackground(_ application: UIApplication) { }

func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillEnterForeground(_ application: UIApplication) { }

func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
func applicationDidBecomeActive(_ application: UIApplication) { }

func applicationWillTerminate(_ application: UIApplication) { }

}

Loading