Skip to content

Commit 42880b3

Browse files
authored
Merge pull request #25 from studyplus/swiftlint
Fix SwiftLint warning and error
2 parents 456b6be + d49959f commit 42880b3

11 files changed

+183
-161
lines changed

Examples/Demo/AppDelegate.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3232

3333
var window: UIWindow?
3434

35-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
35+
func application(_ application: UIApplication,
36+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
3637
return true
3738
}
3839

@@ -47,11 +48,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
4748

4849
func applicationDidBecomeActive(_ application: UIApplication) {
4950
}
50-
51+
5152
func applicationWillTerminate(_ application: UIApplication) {
5253
}
5354

54-
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
55+
func application(_ app: UIApplication,
56+
open url: URL,
57+
options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
5558
print("-- called application(_:open:options:) --")
5659
return Studyplus.shared.handle(appDelegateUrl: url)
5760
}

Examples/Demo/ViewController.swift

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,77 +31,80 @@ class ViewController: UIViewController, StudyplusLoginDelegate {
3131

3232
@IBOutlet weak var isConnectedLabel: UILabel!
3333
@IBOutlet weak var resultLabel: UILabel!
34-
34+
3535
var duration: TimeInterval = TimeInterval()
36-
36+
3737
override func viewDidLoad() {
3838
super.viewDidLoad()
3939
Studyplus.shared.delegate = self
4040
}
41-
41+
4242
// MARK: - Label
4343

4444
private func updateIsConnected() {
4545
isConnectedLabel.text = Studyplus.shared.isConnected() ? "True" : "False"
4646
}
4747

4848
// MARK: - Button Action
49-
49+
5050
@IBAction func loginButton(_ sender: UIButton) {
5151
Studyplus.shared.login()
5252
}
53-
53+
5454
@IBAction func logoutButton(_ sender: UIButton) {
5555
Studyplus.shared.logout()
5656
updateIsConnected()
5757
resultLabel.text = "Logout"
5858
}
59-
59+
6060
@IBAction func connectedButton(_ sender: UIButton) {
6161
updateIsConnected()
6262
resultLabel.text = ""
6363
}
64-
64+
6565
@IBAction func postStudyRecordButton(_ sender: UIButton) {
66-
66+
6767
self.resultLabel.text = ""
68-
68+
6969
let recordAmount: StudyplusRecordAmount = StudyplusRecordAmount(amount: 10)
70-
let record: StudyplusRecord = StudyplusRecord(duration: duration, recordedAt: Date(), amount: recordAmount, comment: "Today, I studied like anything.")
70+
let record: StudyplusRecord = StudyplusRecord(duration: duration,
71+
recordedAt: Date(),
72+
amount: recordAmount,
73+
comment: "Today, I studied like anything.")
74+
75+
Studyplus.shared.post(studyRecord: record, success: {
7176

72-
Studyplus.shared.post(studyRecord: record, success: {
73-
7477
self.resultLabel.text = "Success to post your studyRecord to Studyplus App"
75-
78+
7679
}, failure: { error in
77-
80+
7881
self.resultLabel.text = "Error Code: \(error.code()), Message: \(error.message())"
7982
})
8083
}
81-
84+
8285
// MARK: - Picker
83-
86+
8487
@IBAction func studyRecordDurationPicker(_ sender: UIDatePicker) {
8588
duration = sender.countDownDuration
8689
}
87-
90+
8891
// MARK: - StudyplusLoginDelegate
8992

9093
func studyplusDidSuccessToLogin() {
9194
print("-- Called studyplusDidSuccessToLogin --")
9295
resultLabel.text = "Login succeeded"
9396
updateIsConnected()
9497
}
95-
98+
9699
func studyplusDidFailToLogin(error: StudyplusError) {
97100
print("-- Called studyplusDidFailToLogin --")
98101
resultLabel.text = "Error Code: \(error.code()), Message: \(error.message())"
99102
updateIsConnected()
100103
}
101-
104+
102105
func studyplusDidCancelToLogin() {
103106
print("-- Called studyplusDidCancelToLogin --")
104107
resultLabel.text = "Login canceled"
105108
updateIsConnected()
106-
}
109+
}
107110
}

Examples/DemoTests/DemoTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,27 @@ import XCTest
2828
@testable import Demo
2929

3030
class DemoTests: XCTestCase {
31-
31+
3232
override func setUp() {
3333
super.setUp()
3434
// Put setup code here. This method is called before the invocation of each test method in the class.
3535
}
36-
36+
3737
override func tearDown() {
3838
// Put teardown code here. This method is called after the invocation of each test method in the class.
3939
super.tearDown()
4040
}
41-
41+
4242
func testExample() {
4343
// This is an example of a functional test case.
4444
// Use XCTAssert and related functions to verify your tests produce the correct results.
4545
}
46-
46+
4747
func testPerformanceExample() {
4848
// This is an example of a performance test case.
4949
self.measure {
5050
// Put the code you want to measure the time of here.
5151
}
5252
}
53-
53+
5454
}

0 commit comments

Comments
 (0)