Skip to content

Commit

Permalink
Migrate to Swift 4
Browse files Browse the repository at this point in the history
  • Loading branch information
1000ch committed Sep 30, 2017
1 parent e31d6b5 commit 47c2603
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 33 deletions.
38 changes: 33 additions & 5 deletions PinFeed.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,13 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0820;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "Shogo Sensui";
TargetAttributes = {
C75E239B1C7AD73D00EBF80A = {
CreatedOnToolsVersion = 7.2.1;
DevelopmentTeam = NZR22QGKNQ;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
};
};
Expand Down Expand Up @@ -297,13 +297,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-PinFeed-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
88B0144BFB2BCD374DCEF62F /* [CP] Copy Pods Resources */ = {
Expand All @@ -327,9 +330,20 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-PinFeed/Pods-PinFeed-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework",
"${BUILT_PRODUCTS_DIR}/MisterFusion/MisterFusion.framework",
"${BUILT_PRODUCTS_DIR}/Realm/Realm.framework",
"${BUILT_PRODUCTS_DIR}/RealmSwift/RealmSwift.framework",
"${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MisterFusion.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmSwift.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyJSON.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -397,14 +411,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -445,14 +465,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -499,7 +525,8 @@
PRODUCT_BUNDLE_IDENTIFIER = net.1000ch.PinFeed;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
Expand All @@ -523,7 +550,8 @@
PRODUCT_BUNDLE_IDENTIFIER = net.1000ch.PinFeed;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
Expand Down
4 changes: 2 additions & 2 deletions PinFeed/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="49e-Tb-3d3">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="49e-Tb-3d3">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down
12 changes: 6 additions & 6 deletions PinFeed/Models/Bookmarks.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import RealmSwift

class Bookmarks: Object {
dynamic var d: String = ""
dynamic var t: String = ""
dynamic var u: String = ""
dynamic var dt: String = ""
dynamic var a: String = ""
dynamic var n: String = ""
@objc dynamic var d: String = ""
@objc dynamic var t: String = ""
@objc dynamic var u: String = ""
@objc dynamic var dt: String = ""
@objc dynamic var a: String = ""
@objc dynamic var n: String = ""

convenience init(bookmark: Bookmark) {
self.init()
Expand Down
12 changes: 6 additions & 6 deletions PinFeed/Models/Recents.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import RealmSwift

class Recents: Object {
dynamic var d: String = ""
dynamic var t: String = ""
dynamic var u: String = ""
dynamic var dt: String = ""
dynamic var a: String = ""
dynamic var n: String = ""
@objc dynamic var d: String = ""
@objc dynamic var t: String = ""
@objc dynamic var u: String = ""
@objc dynamic var dt: String = ""
@objc dynamic var a: String = ""
@objc dynamic var n: String = ""

convenience init(bookmark: Bookmark) {
self.init()
Expand Down
4 changes: 2 additions & 2 deletions PinFeed/ViewControllers/BookmarkEditTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ class BookmarkEditTableViewController: UITableViewController {
navigationController?.hidesBarsOnSwipe = false
}

func didTapTableView(gestureRecognizer: UITapGestureRecognizer) {
@objc func didTapTableView(gestureRecognizer: UITapGestureRecognizer) {
tableView.endEditing(true)
}

func saveBookmark(sender: UIButton) {
@objc func saveBookmark(sender: UIButton) {
guard let urlString = url.text else {
return
}
Expand Down
10 changes: 6 additions & 4 deletions PinFeed/ViewControllers/BookmarkViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import MisterFusion

class BookmarkViewController: UIViewController {

@IBOutlet weak var bookmarkTabBarItem: UITabBarItem!

@IBOutlet weak var bookmarkTableView: UITableView!

private let refreshControl = UIRefreshControl()
Expand Down Expand Up @@ -137,7 +139,7 @@ class BookmarkViewController: UIViewController {
}
}

func didRefresh() {
@objc func didRefresh() {
refresh {
if self.refreshControl.isRefreshing {
self.refreshControl.endRefreshing()
Expand All @@ -147,7 +149,7 @@ class BookmarkViewController: UIViewController {
}
}

func didCopyURL(notification: Notification?) {
@objc func didCopyURL(notification: Notification?) {
guard let url = notification?.userInfo?["url"] as? URL else {
return
}
Expand All @@ -173,7 +175,7 @@ class BookmarkViewController: UIViewController {
Timer.scheduledTimer(timeInterval: 5.0, target: self, selector: #selector(didTimeoutNotification), userInfo: nil, repeats: false)
}

func didTapNotification(sender: UIControl) {
@objc func didTapNotification(sender: UIControl) {
guard let webViewController = UIStoryboard.instantiateViewController(name: "Main", identifier: "WebViewController") as? WebViewController else {
return
}
Expand All @@ -188,7 +190,7 @@ class BookmarkViewController: UIViewController {
navigationController?.pushViewController(webViewController, animated: true)
}

func didTimeoutNotification() {
@objc func didTimeoutNotification() {
notificationView?.isHidden = true
}
}
Expand Down
2 changes: 1 addition & 1 deletion PinFeed/ViewControllers/SettingTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class SettingTableViewController: UITableViewController {
}
}

func didTapTableView(gestureRecognizer: UITapGestureRecognizer) {
@objc func didTapTableView(gestureRecognizer: UITapGestureRecognizer) {
tableView.endEditing(true)
}
}
Expand Down
6 changes: 3 additions & 3 deletions PinFeed/ViewControllers/SettingViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SettingViewController: UIViewController {
URLNotificationManager.shared.listen(observer: self, selector: #selector(didCopyURL), object: nil)
}

func didCopyURL(notification: Notification?) {
@objc func didCopyURL(notification: Notification?) {
guard let url = notification?.userInfo?["url"] as? URL else {
return
}
Expand All @@ -63,7 +63,7 @@ class SettingViewController: UIViewController {
Timer.scheduledTimer(timeInterval: 5.0, target: self, selector: #selector(didTimeoutNotification), userInfo: nil, repeats: false)
}

func didTapNotification(sender: UIControl) {
@objc func didTapNotification(sender: UIControl) {
guard let webViewController = UIStoryboard.instantiateViewController(name: "Main", identifier: "WebViewController") as? WebViewController else {
return
}
Expand All @@ -77,7 +77,7 @@ class SettingViewController: UIViewController {
navigationController?.pushViewController(webViewController, animated: true)
}

func didTimeoutNotification() {
@objc func didTimeoutNotification() {
notificationView?.isHidden = true
}
}
Expand Down
14 changes: 10 additions & 4 deletions PinFeed/ViewControllers/TimelineViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class TimelineViewController: UIViewController {
}
}

func didRefresh() {
@objc func didRefresh() {
refresh {
if self.refreshControl.isRefreshing {
self.refreshControl.endRefreshing()
Expand All @@ -150,7 +150,7 @@ class TimelineViewController: UIViewController {
}
}

func didCopyURL(notification: Notification?) {
@objc func didCopyURL(notification: Notification?) {
guard let url = notification?.userInfo?["url"] as? URL else {
return
}
Expand All @@ -176,7 +176,7 @@ class TimelineViewController: UIViewController {
Timer.scheduledTimer(timeInterval: 5.0, target: self, selector: #selector(didTimeoutNotification), userInfo: nil, repeats: false)
}

func didTapNotification(sender: UIControl) {
@objc func didTapNotification(sender: UIControl) {
guard let webViewController = UIStoryboard.instantiateViewController(name: "Main", identifier: "WebViewController") as? WebViewController else {
return
}
Expand All @@ -191,7 +191,7 @@ class TimelineViewController: UIViewController {
navigationController?.pushViewController(webViewController, animated: true)
}

func didTimeoutNotification() {
@objc func didTimeoutNotification() {
notificationView?.isHidden = true
}
}
Expand Down Expand Up @@ -286,3 +286,9 @@ extension TimelineViewController: UIViewControllerPreviewingDelegate {
navigationController?.pushViewController(viewControllerToCommit, animated: true)
}
}

extension TimelineViewController: UITabBarDelegate {
func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
print(item)
}
}

0 comments on commit 47c2603

Please sign in to comment.