Skip to content

Commit

Permalink
Fix warnings by SwiftLint
Browse files Browse the repository at this point in the history
  • Loading branch information
yutailang0119 committed Feb 3, 2017
1 parent 1d2962f commit fcf49c4
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion PyCon-JP/DataSource/More/StaffListDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class StaffListDataSource: NSObject, UITableViewDataSource, StaffListAPIProtocol
self.twitterAction = twitterAction
}

func refreshData(completionHandler: @escaping ((Result<Void>) -> Void)) -> Void {
func refreshData(completionHandler: @escaping ((Result<Void>) -> Void)) {
getStaffs { [weak self](result) in
guard let weakSelf = self else { return }
switch result {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)) -> Void {
func refreshData(completionHandler: @escaping ((Result<Void>) -> Void)) {
loadTalkObjects { [weak self](result) in
guard let weakSelf = self else { return }
switch result {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ConferenceListDataSource: TimelineDataSource, RealmTalksProtocol {
super.init()
}

func refreshData(completionHandler: @escaping ((Result<Void>) -> Void)) -> Void {
func refreshData(completionHandler: @escaping ((Result<Void>) -> Void)) {
loadTalkObjects { [weak self](result) in
guard let weakSelf = self else { return }
switch result {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions PyCon-JP/Protocol/ErrorAlertProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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!

Expand Down
4 changes: 2 additions & 2 deletions PyCon-JP/Protocol/Realm/RealmTalkDetailProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import UIKit

protocol RealmTalkDetailProtocol {
func getTalksFromLocalDummyJson(completionHandler: ((Result<Void>) -> Void)) -> Void
func getTalksFromLocalDummyJson(completionHandler: ((Result<Void>) -> Void))
}

extension RealmTalkDetailProtocol {

func getTalkDetailFromLocalDummyJson(completionHandler: ((Result<TalkDetail>) -> Void)) -> Void {
func getTalkDetailFromLocalDummyJson(completionHandler: ((Result<TalkDetail>) -> Void)) {
let path = Bundle.main.path(forResource: "DummyTalkDetail", ofType: "json")
let fileHandle = FileHandle(forReadingAtPath: path!)
let data = fileHandle?.readDataToEndOfFile()
Expand Down
8 changes: 4 additions & 4 deletions PyCon-JP/Protocol/Realm/RealmTalksProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)) -> Void
func loadTalkObjects(_ completionHandler: ((Result<[TalkObject]>) -> Void))
func getTalksFromLocalDummyJson(completionHandler: ((Result<Void>) -> 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))
Expand All @@ -33,7 +33,7 @@ extension RealmTalksProtocol {

extension RealmTalksProtocol {

func getTalksFromLocalDummyJson(completionHandler: ((Result<Void>) -> Void)) -> Void {
func getTalksFromLocalDummyJson(completionHandler: ((Result<Void>) -> Void)) {
let path = Bundle.main.path(forResource: "DummyTalks", ofType: "json")
let fileHandle = FileHandle(forReadingAtPath: path!)
let data = fileHandle?.readDataToEndOfFile()
Expand Down
10 changes: 5 additions & 5 deletions PyCon-JP/Protocol/URLScheme/TwitterURLSchemeProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)

}

Expand All @@ -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 {
Expand All @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions PyCon-JP/Protocol/WebAPI/StaffListAPIProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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]] ?? []
Expand Down
6 changes: 3 additions & 3 deletions PyCon-JP/Protocol/WebAPI/TalkDetailAPIProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import WebAPIFramework
protocol TalkDetailAPIProtocol: AlamofireProtocol {
var id: Int? { get set }

func getTalkDetail(completionHandler: @escaping ((Result<TalkDetail>) -> Void)) -> Void
func getTalkDetail(completionHandler: @escaping ((Result<TalkDetail>) -> Void))
}

extension TalkDetailAPIProtocol {
Expand All @@ -26,8 +26,8 @@ extension TalkDetailAPIProtocol {

extension TalkDetailAPIProtocol {

func getTalkDetail(completionHandler: @escaping ((Result<TalkDetail>) -> Void)) -> Void {
get() { result in
func getTalkDetail(completionHandler: @escaping ((Result<TalkDetail>) -> Void)) {
get { result in
switch result {
case .success(let value):
let talkDetail = TalkDetail(dictionary: value)
Expand Down
6 changes: 3 additions & 3 deletions PyCon-JP/Protocol/WebAPI/TalksAPIProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import WebAPIFramework
import RealmSwift

protocol TalksAPIProtocol: AlamofireProtocol {
func getTalks(completionHandler: @escaping ((Result<Void>) -> Void)) -> Void
func getTalks(completionHandler: @escaping ((Result<Void>) -> Void))
}

extension TalksAPIProtocol {
Expand All @@ -24,8 +24,8 @@ extension TalksAPIProtocol {

extension TalksAPIProtocol {

func getTalks(completionHandler: @escaping ((Result<Void>) -> Void)) -> Void {
get() { result in
func getTalks(completionHandler: @escaping ((Result<Void>) -> Void)) {
get { result in
switch result {
case .success(let value):
let presentations = value["presentations"] as? [[String: Any]] ?? [[String: Any]]()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}

}
Expand Down
4 changes: 2 additions & 2 deletions WebAPIFramework/Alamofire/AlamofireProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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<Any>) in
switch response.result {
Expand Down

0 comments on commit fcf49c4

Please sign in to comment.