Skip to content
This repository was archived by the owner on Jul 2, 2023. It is now read-only.

Commit c613e55

Browse files
committed
Update swift version to 4.2
1 parent 07da450 commit c613e55

File tree

50 files changed

+143
-110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+143
-110
lines changed

Example/AppDelegate.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1313

1414
var window: UIWindow?
1515

16-
public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
16+
public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
1717

1818
UIView.appearance().tintColor = UIColor(named: "Deep Carmine Pink")
1919

Example/Example/CalendarEvent/Event/CalendarEventObject.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// CalendarEventObject.swift
33
// Example
44
//
5-
// Created by wc on 29/10/2017.
5+
// Created by DianQK on 29/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

Example/Example/CalendarEvent/Event/DateSelectProvider.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// DateSelectProvider.swift
33
// Example
44
//
5-
// Created by wc on 28/10/2017.
5+
// Created by DianQK on 28/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

@@ -141,8 +141,8 @@ class DateSelectGroupProvider: AnimatableTableViewGroupProvider {
141141
return NSAttributedString(
142142
string: date,
143143
attributes: [
144-
NSAttributedStringKey.strikethroughStyle: (isAvailable ? NSUnderlineStyle.styleNone : NSUnderlineStyle.styleSingle).rawValue,
145-
NSAttributedStringKey.foregroundColor: textColor
144+
NSAttributedString.Key.strikethroughStyle: (isAvailable ? [] : NSUnderlineStyle.single).rawValue,
145+
NSAttributedString.Key.foregroundColor: textColor
146146
]
147147
)
148148
}

Example/Example/CalendarEvent/Event/EventEditViewController.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// EventEditViewController.swift
33
// Example
44
//
5-
// Created by wc on 27/10/2017.
5+
// Created by DianQK on 27/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

@@ -21,7 +21,7 @@ extension String {
2121

2222
class EventEditViewController: TableViewController {
2323

24-
let cancelBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.cancel, target: nil, action: nil)
24+
let cancelBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.cancel, target: nil, action: nil)
2525
let addBarButtonItem = UIBarButtonItem(title: "Add", style: .plain, target: nil, action: nil)
2626

2727
private(set) var saved: Observable<CalendarEventObject>! = nil

Example/Example/CalendarEvent/Event/EventListViewController.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// EventListViewController.swift
33
// Example
44
//
5-
// Created by wc on 27/10/2017.
5+
// Created by DianQK on 27/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

@@ -56,7 +56,7 @@ class EventListViewController: TableViewController {
5656
super.viewDidLoad()
5757
title = "All Events"
5858

59-
let addBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.add, target: nil, action: nil)
59+
let addBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.add, target: nil, action: nil)
6060
self.navigationItem.rightBarButtonItem = addBarButtonItem
6161
Observable.merge([
6262
addBarButtonItem.rx.tap.map { nil as CalendarEventObject? },

Example/Example/CalendarEvent/Event/SelectedLocationProvider.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SelectedLocationProvider.swift
33
// Example
44
//
5-
// Created by wc on 27/10/2017.
5+
// Created by DianQK on 27/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

Example/Example/CalendarEvent/Event/SpacingSectionProvider.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SpacingSectionProvider.swift
33
// Example
44
//
5-
// Created by wc on 27/10/2017.
5+
// Created by DianQK on 27/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

Example/Example/CalendarEvent/Event/StartAndEndDateGroupProvider.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// StartAndEndDateGroupProvider.swift
33
// Example
44
//
5-
// Created by wc on 29/10/2017.
5+
// Created by DianQK on 29/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

Example/Example/CalendarEvent/Event/TextFieldProvider.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// TextFieldProvider.swift
33
// Example
44
//
5-
// Created by wc on 27/10/2017.
5+
// Created by DianQK on 27/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

Example/Example/CalendarEvent/Event/TextViewProvider.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// TextViewProvider.swift
33
// Example
44
//
5-
// Created by wc on 29/10/2017.
5+
// Created by DianQK on 29/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

@@ -55,7 +55,7 @@ class TextViewProvider: UITextView, UniqueAnimatableTableViewProvider {
5555
}
5656

5757
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath, value: TextViewProvider) -> CGFloat? {
58-
let height = NSAttributedString(string: value.text, attributes: [NSAttributedStringKey.font : UIFont.systemFont(ofSize: 17)]).boundingRect(with: CGSize(width: tableView.bounds.width - 40, height: CGFloat.greatestFiniteMagnitude), options: [NSStringDrawingOptions.usesFontLeading, .usesLineFragmentOrigin], context: nil).height + 12
58+
let height = NSAttributedString(string: value.text, attributes: [NSAttributedString.Key.font : UIFont.systemFont(ofSize: 17)]).boundingRect(with: CGSize(width: tableView.bounds.width - 40, height: CGFloat.greatestFiniteMagnitude), options: [NSStringDrawingOptions.usesFontLeading, .usesLineFragmentOrigin], context: nil).height + 12
5959
return max(120, height)
6060
}
6161

Example/Example/CalendarEvent/Location/LocalSearchProvider.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// LocalSearchProvider.swift
33
// Example
44
//
5-
// Created by wc on 25/10/2017.
5+
// Created by DianQK on 25/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

@@ -20,7 +20,7 @@ class PlacemarkTableViewCell: UITableViewCell {
2020
let addressLabel = UILabel()
2121
let locationImageView = UIImageView(image: #imageLiteral(resourceName: "Icon Location Red"))
2222

23-
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
23+
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
2424
super.init(style: style, reuseIdentifier: reuseIdentifier)
2525

2626
self.separatorInset = UIEdgeInsets(top: 0, left: 56, bottom: 0, right: 0)

Example/Example/CalendarEvent/Location/MKLocalSearch+Rx.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// MKLocalSearch+Rx.swift
33
// Example
44
//
5-
// Created by wc on 25/10/2017.
5+
// Created by DianQK on 25/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

@@ -13,7 +13,7 @@ import MapKit
1313
extension MKLocalSearch {
1414

1515
convenience init(naturalLanguageQuery: String) {
16-
let request = MKLocalSearchRequest()
16+
let request = MKLocalSearch.Request()
1717
request.naturalLanguageQuery = naturalLanguageQuery
1818
self.init(request: request)
1919
}
@@ -22,7 +22,7 @@ extension MKLocalSearch {
2222

2323
extension Reactive where Base: MKLocalSearch {
2424

25-
var start: Observable<MKLocalSearchResponse?> {
25+
var start: Observable<MKLocalSearch.Response?> {
2626
return Observable.create({ [weak search = self.base] (observer) -> Disposable in
2727
guard let search = search else {
2828
observer.onCompleted()

Example/Example/CalendarEvent/Location/SelectLocationViewController.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SelectLocationViewController.swift
33
// Example
44
//
5-
// Created by wc on 25/10/2017.
5+
// Created by DianQK on 25/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

@@ -53,7 +53,7 @@ class SelectLocationViewController: UIViewController {
5353

5454
let geocoder = CLGeocoder()
5555

56-
let cancelBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.cancel, target: nil, action: nil)
56+
let cancelBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.cancel, target: nil, action: nil)
5757

5858
let didSelectLocation = PublishSubject<EventLocation>()
5959

Example/Example/CalendarEvent/Options/EventOptionProvider.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// EventOptionProvider.swift
33
// Example
44
//
5-
// Created by wc on 29/10/2017.
5+
// Created by DianQK on 29/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

Example/Example/CalendarEvent/Options/EventOptionsViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// EventOptionsViewController.swift
33
// Example
44
//
5-
// Created by wc on 29/10/2017.
5+
// Created by DianQK on 29/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

Example/Example/CalendarEvent/Repeat/EndRepeatProvider.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// EndRepeatProvider.swift
33
// Example
44
//
5-
// Created by wc on 29/10/2017.
5+
// Created by DianQK on 29/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

Example/Example/CalendarEvent/Repeat/EndRepeatSelectViewController.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// EndRepeatSelectViewController.swift
33
// Example
44
//
5-
// Created by wc on 29/10/2017.
5+
// Created by DianQK on 29/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

@@ -50,15 +50,15 @@ class EndRepeatSelectViewController: TableViewController {
5050

5151
let isNever = self.endRepeatDate.asObservable().map { $0 == nil }
5252

53-
isNever.map { $0 ? UITableViewCellAccessoryType.checkmark : UITableViewCellAccessoryType.none }
53+
isNever.map { $0 ? UITableViewCell.AccessoryType.checkmark : UITableViewCell.AccessoryType.none }
5454
.subscribe(onNext: { [weak self] (accessoryType) in
5555
self?.neverProvider.accessoryType = accessoryType
5656
})
5757
.disposed(by: disposeBag)
5858

5959
isNever
6060
.subscribe(onNext: { [weak self] (isNever) in
61-
self?.onDateProvider.accessoryType = isNever ? UITableViewCellAccessoryType.none : UITableViewCellAccessoryType.checkmark
61+
self?.onDateProvider.accessoryType = isNever ? UITableViewCell.AccessoryType.none : UITableViewCell.AccessoryType.checkmark
6262
self?.onDateProvider.titleLabel.textColor = isNever ? UIColor.darkText : UIColor(named: "Deep Carmine Pink")
6363
})
6464
.disposed(by: disposeBag)

Example/Example/CalendarEvent/Repeat/RepeatGroupProvider.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RepeatGroupProvider.swift
33
// Example
44
//
5-
// Created by wc on 29/10/2017.
5+
// Created by DianQK on 29/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

Example/Example/CalendarEvent/TimeZone/SelectTimeZoneViewController.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SelectTimeZoneViewController.swift
33
// Example
44
//
5-
// Created by wc on 29/10/2017.
5+
// Created by DianQK on 29/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

@@ -15,7 +15,7 @@ class TitleTableViewCell: UITableViewCell {
1515

1616
let titleLabel = UILabel()
1717

18-
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
18+
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
1919
super.init(style: style, reuseIdentifier: reuseIdentifier)
2020

2121
self.contentView.addSubview(titleLabel)

Example/Example/DeleteItemViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class TagTableViewCell: UITableViewCell {
3131
let titleLabel = UILabel()
3232
let textField = UITextField()
3333

34-
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
34+
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
3535
super.init(style: style, reuseIdentifier: reuseIdentifier)
3636

3737
selectionStyle = .none

Example/Example/GitHubSigup/Wireframe.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class DefaultWireframe: Wireframe {
3131
static let shared = DefaultWireframe()
3232

3333
func open(url: URL) {
34-
UIApplication.shared.open(url, options: [:], completionHandler: nil)
34+
UIApplication.shared.open(url, options: convertToUIApplicationOpenExternalURLOptionsKeyDictionary([:]), completionHandler: nil)
3535
}
3636

3737
#if os(iOS)
@@ -87,3 +87,8 @@ extension RetryResult : CustomStringConvertible {
8787
}
8888
}
8989
}
90+
91+
// Helper function inserted by Swift 4.2 migrator.
92+
fileprivate func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(_ input: [String: Any]) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
93+
return Dictionary(uniqueKeysWithValues: input.map { key, value in (UIApplication.OpenExternalURLOptionsKey(rawValue: key), value)})
94+
}

Example/Example/NestFormViewController.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class ItemInputTableViewCell: UITableViewCell {
6767
let titleLabel = UILabel()
6868
let textField = UITextField()
6969

70-
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
70+
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
7171
super.init(style: style, reuseIdentifier: reuseIdentifier)
7272

7373
selectionStyle = .none
@@ -106,7 +106,7 @@ class TextTableViewCell: UITableViewCell {
106106

107107
let contentLabel = UILabel()
108108

109-
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
109+
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
110110
super.init(style: style, reuseIdentifier: reuseIdentifier)
111111
contentLabel.textAlignment = .center
112112
self.contentView.addSubview(contentLabel)

Example/Example/StoryboardViewController.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// StoryboardViewController.swift
33
// Example
44
//
5-
// Created by wc on 23/10/2017.
5+
// Created by DianQK on 23/10/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

@@ -15,13 +15,13 @@ class StoryboardViewController: UIViewController {
1515

1616
@IBAction func flixLogoClicked(_ sender: FlixStackItemProvider) {
1717
let alert = UIAlertController(title: nil, message: "Logo Clicked", preferredStyle: .alert)
18-
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
18+
alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
1919
self.present(alert, animated: true, completion: nil)
2020
}
2121

2222
@IBAction func flixContentClicked(_ sender: FlixStackItemProvider) {
2323
let alert = UIAlertController(title: nil, message: "Content Clicked", preferredStyle: .alert)
24-
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
24+
alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
2525
self.present(alert, animated: true, completion: nil)
2626
}
2727

Example/Example/Tutorial/AppsProvider.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AppsProvider.swift
33
// Example
44
//
5-
// Created by wc on 04/11/2017.
5+
// Created by DianQK on 04/11/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

@@ -28,7 +28,7 @@ class AppTableViewCell: UITableViewCell {
2828
return stackView
2929
}()
3030

31-
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
31+
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
3232
super.init(style: style, reuseIdentifier: reuseIdentifier)
3333
leftStackView.addArrangedSubview(iconImageView)
3434
leftStackView.addArrangedSubview(titleLabel)

Example/Example/Tutorial/ProfileProvider.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// ProfileProvider.swift
33
// Example
44
//
5-
// Created by wc on 04/11/2017.
5+
// Created by DianQK on 04/11/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

Example/Example/Tutorial/SettingsViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SettingsViewController.swift
33
// Example
44
//
5-
// Created by wc on 02/11/2017.
5+
// Created by DianQK on 02/11/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

Example/Example/Tutorial/TableViewProvider.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SwitchProvider.swift
33
// Example
44
//
5-
// Created by wc on 04/11/2017.
5+
// Created by DianQK on 04/11/2017.
66
// Copyright © 2017 DianQK. All rights reserved.
77
//
88

@@ -38,7 +38,7 @@ class BaseTableViewCellProvider: SingleUITableViewCellProvider {
3838
let stackView = UIStackView()
3939
stackView.axis = .vertical
4040
stackView.spacing = 1
41-
stackView.alignment = UIStackViewAlignment.leading
41+
stackView.alignment = UIStackView.Alignment.leading
4242
return stackView
4343
}()
4444

0 commit comments

Comments
 (0)