diff --git a/PyCon-JP/DataSource/More/StaffListDataSource.swift b/PyCon-JP/DataSource/More/StaffListDataSource.swift index 0118b47..c0ea6f0 100644 --- a/PyCon-JP/DataSource/More/StaffListDataSource.swift +++ b/PyCon-JP/DataSource/More/StaffListDataSource.swift @@ -22,7 +22,7 @@ class StaffListDataSource: NSObject, UITableViewDataSource, StaffListAPIProtocol self.twitterAction = twitterAction } - func refreshData(completionHandler: @escaping ((Result) -> Void)) -> Void { + func refreshData(completionHandler: @escaping ((Result) -> Void)) { getStaffs { [weak self](result) in guard let weakSelf = self else { return } switch result { diff --git a/PyCon-JP/DataSource/Timeline/Bookmark/BookmarkListDataSource.swift b/PyCon-JP/DataSource/Timeline/Bookmark/BookmarkListDataSource.swift index c86c905..d2abcab 100644 --- a/PyCon-JP/DataSource/Timeline/Bookmark/BookmarkListDataSource.swift +++ b/PyCon-JP/DataSource/Timeline/Bookmark/BookmarkListDataSource.swift @@ -14,7 +14,7 @@ class BookmarkListDataSource: TimelineDataSource, RealmTalksProtocol { let filterPredicate = NSPredicate(format: "favorited == %@", true as CVarArg) let sortProperties = [SortDescriptor(property: "date", ascending: true), SortDescriptor(property: "place", ascending: true)] - func refreshData(completionHandler: @escaping ((Result) -> Void)) -> Void { + func refreshData(completionHandler: @escaping ((Result) -> Void)) { loadTalkObjects { [weak self](result) in guard let weakSelf = self else { return } switch result { diff --git a/PyCon-JP/DataSource/Timeline/Conference/ConferenceListDataSource.swift b/PyCon-JP/DataSource/Timeline/Conference/ConferenceListDataSource.swift index e8dd632..24e4e1f 100644 --- a/PyCon-JP/DataSource/Timeline/Conference/ConferenceListDataSource.swift +++ b/PyCon-JP/DataSource/Timeline/Conference/ConferenceListDataSource.swift @@ -19,7 +19,7 @@ class ConferenceListDataSource: TimelineDataSource, RealmTalksProtocol { super.init() } - func refreshData(completionHandler: @escaping ((Result) -> Void)) -> Void { + func refreshData(completionHandler: @escaping ((Result) -> Void)) { loadTalkObjects { [weak self](result) in guard let weakSelf = self else { return } switch result { diff --git a/PyCon-JP/Manager/Notification/LocalNotificationManager.swift b/PyCon-JP/Manager/Notification/LocalNotificationManager.swift index 13447ed..b0c68ad 100644 --- a/PyCon-JP/Manager/Notification/LocalNotificationManager.swift +++ b/PyCon-JP/Manager/Notification/LocalNotificationManager.swift @@ -45,7 +45,7 @@ class LocalNotificationManager: NSObject { func cancelSchedule(talkDetail: TalkDetail) { if let localNotifications = UIApplication.shared.scheduledLocalNotifications { - localNotifications.forEach({ (notification) -> () in + localNotifications.forEach({ notification in if let userInfo = notification.userInfo { if userInfo["id"] as! Int == talkDetail.talkObject.id { UIApplication.shared.cancelLocalNotification(notification) diff --git a/PyCon-JP/Manager/Notification/ReceiveLocalNotificationManager.swift b/PyCon-JP/Manager/Notification/ReceiveLocalNotificationManager.swift index 6bb8ef1..19c55eb 100644 --- a/PyCon-JP/Manager/Notification/ReceiveLocalNotificationManager.swift +++ b/PyCon-JP/Manager/Notification/ReceiveLocalNotificationManager.swift @@ -16,7 +16,7 @@ class ReceiveLocalNotificationManager: NSObject { case "Talk" where application.applicationState == .active: let alertController = UIAlertController(title: "", message: "", preferredStyle: .alert) alertController.addAction(UIAlertAction(title: "閉じる", style: .default, handler: nil)) - alertController.addAction(UIAlertAction(title: "詳細へ", style: .default, handler: {(action) -> Void in + alertController.addAction(UIAlertAction(title: "詳細へ", style: .default, handler: { _ -> Void in appDelegate.openTalkDetailViewController(id: id) })) if let appDelegate = UIApplication.shared.delegate as? AppDelegate { diff --git a/PyCon-JP/Protocol/ErrorAlertProtocol.swift b/PyCon-JP/Protocol/ErrorAlertProtocol.swift index e184982..c1cabf7 100644 --- a/PyCon-JP/Protocol/ErrorAlertProtocol.swift +++ b/PyCon-JP/Protocol/ErrorAlertProtocol.swift @@ -9,12 +9,12 @@ import UIKit protocol ErrorAlertProtocol { - func showErrorAlart(with error: Error, parent viewController: UIViewController?) -> Void + func showErrorAlart(with error: Error, parent viewController: UIViewController?) } extension ErrorAlertProtocol { - func showErrorAlart(with error: Error, parent viewController: UIViewController? = nil) -> Void { + func showErrorAlart(with error: Error, parent viewController: UIViewController? = nil) { let rootViewController = viewController != nil ? viewController! : UIApplication.shared.keyWindow!.rootViewController! diff --git a/PyCon-JP/Protocol/Realm/RealmTalkDetailProtocol.swift b/PyCon-JP/Protocol/Realm/RealmTalkDetailProtocol.swift index b377bd0..857476a 100644 --- a/PyCon-JP/Protocol/Realm/RealmTalkDetailProtocol.swift +++ b/PyCon-JP/Protocol/Realm/RealmTalkDetailProtocol.swift @@ -9,12 +9,12 @@ import UIKit protocol RealmTalkDetailProtocol { - func getTalksFromLocalDummyJson(completionHandler: ((Result) -> Void)) -> Void + func getTalksFromLocalDummyJson(completionHandler: ((Result) -> Void)) } extension RealmTalkDetailProtocol { - func getTalkDetailFromLocalDummyJson(completionHandler: ((Result) -> Void)) -> Void { + func getTalkDetailFromLocalDummyJson(completionHandler: ((Result) -> Void)) { let path = Bundle.main.path(forResource: "DummyTalkDetail", ofType: "json") let fileHandle = FileHandle(forReadingAtPath: path!) let data = fileHandle?.readDataToEndOfFile() diff --git a/PyCon-JP/Protocol/Realm/RealmTalksProtocol.swift b/PyCon-JP/Protocol/Realm/RealmTalksProtocol.swift index 353a4c1..099be55 100644 --- a/PyCon-JP/Protocol/Realm/RealmTalksProtocol.swift +++ b/PyCon-JP/Protocol/Realm/RealmTalksProtocol.swift @@ -13,13 +13,13 @@ protocol RealmTalksProtocol { var filterPredicate: NSPredicate { get } var sortProperties: [SortDescriptor] { get } - func loadTalkObjects(_ completionHandler: ((Result<[TalkObject]>) -> Void)) -> Void - func getTalksFromLocalDummyJson(completionHandler: ((Result) -> Void)) -> Void + func loadTalkObjects(_ completionHandler: ((Result<[TalkObject]>) -> Void)) + func getTalksFromLocalDummyJson(completionHandler: ((Result) -> Void)) } extension RealmTalksProtocol { - func loadTalkObjects(_ completionHandler: ((Result<[TalkObject]>) -> Void)) -> Void { + func loadTalkObjects(_ completionHandler: ((Result<[TalkObject]>) -> Void)) { do { let realm = try Realm() let talks = Array(realm.objects(TalkObject.self).filter(filterPredicate).sorted(by: sortProperties)) @@ -33,7 +33,7 @@ extension RealmTalksProtocol { extension RealmTalksProtocol { - func getTalksFromLocalDummyJson(completionHandler: ((Result) -> Void)) -> Void { + func getTalksFromLocalDummyJson(completionHandler: ((Result) -> Void)) { let path = Bundle.main.path(forResource: "DummyTalks", ofType: "json") let fileHandle = FileHandle(forReadingAtPath: path!) let data = fileHandle?.readDataToEndOfFile() diff --git a/PyCon-JP/Protocol/URLScheme/TwitterURLSchemeProtocol.swift b/PyCon-JP/Protocol/URLScheme/TwitterURLSchemeProtocol.swift index 85245c6..33fbdc1 100644 --- a/PyCon-JP/Protocol/URLScheme/TwitterURLSchemeProtocol.swift +++ b/PyCon-JP/Protocol/URLScheme/TwitterURLSchemeProtocol.swift @@ -11,8 +11,8 @@ import SafariServices protocol TwitterURLSchemeProtocol { - func openTwitter(userName: String, from viewController: UIViewController, alertBefore: Bool) -> Void - func openTwitter(hashTag: String, from viewController: UIViewController, alertBefore: Bool) -> Void + func openTwitter(userName: String, from viewController: UIViewController, alertBefore: Bool) + func openTwitter(hashTag: String, from viewController: UIViewController, alertBefore: Bool) } @@ -26,14 +26,14 @@ extension TwitterURLSchemeProtocol { let alertController = UIAlertController(title: NSLocalizedString("TwitterAlertTitle", tableName: "URLScheme", comment: ""), message: String(format: NSLocalizedString("TwitterAlertMessage", tableName: "URLScheme", comment: ""), arguments: [targetName]), preferredStyle: .alert) - alertController.addAction(UIAlertAction(title: NSLocalizedString("Open", comment: ""), style: .default, handler: { action in + alertController.addAction(UIAlertAction(title: NSLocalizedString("Open", comment: ""), style: .default, handler: { _ in UIApplication.shared.openURL(url) })) alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .cancel, handler: nil)) viewController.present(alertController, animated: true, completion: nil) } - func openTwitter(userName: String, from viewController: UIViewController, alertBefore: Bool = false) -> Void { + func openTwitter(userName: String, from viewController: UIViewController, alertBefore: Bool = false) { if UIApplication.shared.canOpenURL(urlScheme) { guard let url = URL(string: "twitter://user?screen_name=" + userName) else { return } if alertBefore { @@ -48,7 +48,7 @@ extension TwitterURLSchemeProtocol { } } - func openTwitter(hashTag: String, from viewController: UIViewController, alertBefore: Bool = false) -> Void { + func openTwitter(hashTag: String, from viewController: UIViewController, alertBefore: Bool = false) { if UIApplication.shared.canOpenURL(urlScheme) { guard let url = URL(string: "twitter://search?query=%23" + hashTag) else { return } if alertBefore { diff --git a/PyCon-JP/Protocol/WebAPI/StaffListAPIProtocol.swift b/PyCon-JP/Protocol/WebAPI/StaffListAPIProtocol.swift index 9b8b563..363d977 100644 --- a/PyCon-JP/Protocol/WebAPI/StaffListAPIProtocol.swift +++ b/PyCon-JP/Protocol/WebAPI/StaffListAPIProtocol.swift @@ -10,7 +10,7 @@ import UIKit import WebAPIFramework protocol StaffListAPIProtocol: AlamofireProtocol { - func getStaffs(completionHandler: @escaping ((Result<[Staff]>) -> Void)) -> Void + func getStaffs(completionHandler: @escaping ((Result<[Staff]>) -> Void)) } extension StaffListAPIProtocol { @@ -27,8 +27,8 @@ extension StaffListAPIProtocol { extension StaffListAPIProtocol { - func getStaffs(completionHandler: @escaping ((Result<[Staff]>) -> Void)) -> Void { - get() { result in + func getStaffs(completionHandler: @escaping ((Result<[Staff]>) -> Void)) { + get { result in switch result { case .success(let value): let staffList = value["staffList"] as? [[String: Any]] ?? [] diff --git a/PyCon-JP/Protocol/WebAPI/TalkDetailAPIProtocol.swift b/PyCon-JP/Protocol/WebAPI/TalkDetailAPIProtocol.swift index e5b17a4..33ef277 100644 --- a/PyCon-JP/Protocol/WebAPI/TalkDetailAPIProtocol.swift +++ b/PyCon-JP/Protocol/WebAPI/TalkDetailAPIProtocol.swift @@ -12,7 +12,7 @@ import WebAPIFramework protocol TalkDetailAPIProtocol: AlamofireProtocol { var id: Int? { get set } - func getTalkDetail(completionHandler: @escaping ((Result) -> Void)) -> Void + func getTalkDetail(completionHandler: @escaping ((Result) -> Void)) } extension TalkDetailAPIProtocol { @@ -26,8 +26,8 @@ extension TalkDetailAPIProtocol { extension TalkDetailAPIProtocol { - func getTalkDetail(completionHandler: @escaping ((Result) -> Void)) -> Void { - get() { result in + func getTalkDetail(completionHandler: @escaping ((Result) -> Void)) { + get { result in switch result { case .success(let value): let talkDetail = TalkDetail(dictionary: value) diff --git a/PyCon-JP/Protocol/WebAPI/TalksAPIProtocol.swift b/PyCon-JP/Protocol/WebAPI/TalksAPIProtocol.swift index 9f1a400..ecbd2fc 100644 --- a/PyCon-JP/Protocol/WebAPI/TalksAPIProtocol.swift +++ b/PyCon-JP/Protocol/WebAPI/TalksAPIProtocol.swift @@ -11,7 +11,7 @@ import WebAPIFramework import RealmSwift protocol TalksAPIProtocol: AlamofireProtocol { - func getTalks(completionHandler: @escaping ((Result) -> Void)) -> Void + func getTalks(completionHandler: @escaping ((Result) -> Void)) } extension TalksAPIProtocol { @@ -24,8 +24,8 @@ extension TalksAPIProtocol { extension TalksAPIProtocol { - func getTalks(completionHandler: @escaping ((Result) -> Void)) -> Void { - get() { result in + func getTalks(completionHandler: @escaping ((Result) -> Void)) { + get { result in switch result { case .success(let value): let presentations = value["presentations"] as? [[String: Any]] ?? [[String: Any]]() diff --git a/PyCon-JP/ViewController/Base/ZoomableImageViewController.swift b/PyCon-JP/ViewController/Base/ZoomableImageViewController.swift index 76031f7..cfbda25 100644 --- a/PyCon-JP/ViewController/Base/ZoomableImageViewController.swift +++ b/PyCon-JP/ViewController/Base/ZoomableImageViewController.swift @@ -51,7 +51,7 @@ class ZoomableImageViewController: UIViewController, UIScrollViewDelegate { if toHidden { UIView.animate(withDuration: 0.2, animations: { self.toolBar.alpha = 0 - }, completion: { finished in + }, completion: { _ in self.toolBar.isHidden = true }) } else { diff --git a/PyCon-JP/ViewController/Conference/ConferencePageViewController.swift b/PyCon-JP/ViewController/Conference/ConferencePageViewController.swift index 36e66bc..cb461c9 100644 --- a/PyCon-JP/ViewController/Conference/ConferencePageViewController.swift +++ b/PyCon-JP/ViewController/Conference/ConferencePageViewController.swift @@ -17,13 +17,13 @@ class ConferencePageViewController: UIPageViewController, ConferencePageViewProt let startingViewController = self.conferenceModelController.viewController(index: 0, storyboard: self.storyboard!)! let viewControllers = [startingViewController] - self.setViewControllers(viewControllers, direction: .forward, animated: false, completion: {done in }) + self.setViewControllers(viewControllers, direction: .forward, animated: false) self.dataSource = self.conferenceModelController } - private var _conferenceModelController: ConferenceModelController? = nil + private var _conferenceModelController: ConferenceModelController? private var conferenceModelController: ConferenceModelController { if _conferenceModelController == nil { @@ -61,7 +61,7 @@ class ConferencePageViewController: UIPageViewController, ConferencePageViewProt private func movePage(index: Int, direction: UIPageViewControllerNavigationDirection) { let viewController = conferenceModelController.viewController(index: index, storyboard: self.storyboard!)! let viewControllers = [viewController] - self.setViewControllers(viewControllers, direction: direction, animated: true, completion: {done in}) + self.setViewControllers(viewControllers, direction: direction, animated: true) } } diff --git a/WebAPIFramework/Alamofire/AlamofireProtocol.swift b/WebAPIFramework/Alamofire/AlamofireProtocol.swift index a29f621..5e6791f 100644 --- a/WebAPIFramework/Alamofire/AlamofireProtocol.swift +++ b/WebAPIFramework/Alamofire/AlamofireProtocol.swift @@ -15,7 +15,7 @@ public protocol AlamofireProtocol { var authUser: String { get } var authPassword: String { get } - func get(parameter: [String: Any]?, completionHandler: @escaping ((Result<[String: Any]>) -> Void)) -> Void + func get(parameter: [String: Any]?, completionHandler: @escaping ((Result<[String: Any]>) -> Void)) } public extension AlamofireProtocol { @@ -36,7 +36,7 @@ public extension AlamofireProtocol { public extension AlamofireProtocol { - func get(parameter: [String: Any]? = nil, completionHandler: @escaping ((Result<[String: Any]>) -> Void)) -> Void { + func get(parameter: [String: Any]? = nil, completionHandler: @escaping ((Result<[String: Any]>) -> Void)) { let url = baseURL + path let responseClosure = { (response: DataResponse) in switch response.result {