diff --git a/Emojr.xcodeproj/project.pbxproj b/Emojr.xcodeproj/project.pbxproj index d4443e7..56eead0 100644 --- a/Emojr.xcodeproj/project.pbxproj +++ b/Emojr.xcodeproj/project.pbxproj @@ -526,11 +526,11 @@ 1546D3961CA61A5100D8ECC5 = { CreatedOnToolsVersion = 7.2.1; DevelopmentTeam = M2JNHSR23U; - LastSwiftMigration = 0810; + LastSwiftMigration = 0920; }; 1589F8941D27556600451912 = { CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 0810; + LastSwiftMigration = 0920; TestTargetID = 1546D3961CA61A5100D8ECC5; }; }; @@ -906,7 +906,8 @@ PROVISIONING_PROFILE = ""; SWIFT_OBJC_BRIDGING_HEADER = "Emojr-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -931,7 +932,8 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; SWIFT_OBJC_BRIDGING_HEADER = "Emojr-Bridging-Header.h"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; }; name = Release; }; @@ -946,7 +948,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.josephpecoraro.EmojrTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Emojr.app/Emojr"; }; name = Debug; @@ -962,7 +965,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.josephpecoraro.EmojrTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Emojr.app/Emojr"; }; name = Release; diff --git a/Emojr/AccountViewController.swift b/Emojr/AccountViewController.swift index 3873d05..ec607e5 100644 --- a/Emojr/AccountViewController.swift +++ b/Emojr/AccountViewController.swift @@ -16,7 +16,7 @@ extension UILabel { let style = NSMutableParagraphStyle() style.lineSpacing = height - string.addAttribute(NSParagraphStyleAttributeName, + string.addAttribute(NSAttributedStringKey.paragraphStyle, value: style, range: NSRange(location: 0, length: text.characters.count)) diff --git a/Emojr/DiscoverViewController.swift b/Emojr/DiscoverViewController.swift index 70f1476..d6e4d04 100644 --- a/Emojr/DiscoverViewController.swift +++ b/Emojr/DiscoverViewController.swift @@ -13,7 +13,7 @@ class DiscoverViewController: TimelineViewController { private lazy var searchButton: UIBarButtonItem = { let buttonImage = #imageLiteral(resourceName: "searchEmoji").withRenderingMode(.alwaysOriginal) let button = UIBarButtonItem(image: buttonImage, style: .plain, target: self, action: #selector(searchButtonTapped)) - button.setTitleTextAttributes([NSFontAttributeName : UIFont.systemFont(ofSize: 32)], for: UIControlState()) + button.setTitleTextAttributes([NSAttributedStringKey.font : UIFont.systemFont(ofSize: 32)], for: UIControlState()) return button }() @@ -34,7 +34,7 @@ class DiscoverViewController: TimelineViewController { // MARK: - Action - func searchButtonTapped(sender: UIBarButtonItem) { + @objc func searchButtonTapped(sender: UIBarButtonItem) { if User.sharedInstance.isLoggedIn { let addUserVC = AddUsersViewController() self.navigationController?.pushViewController(addUserVC, animated: true) diff --git a/Emojr/EmojiSlotMachine.swift b/Emojr/EmojiSlotMachine.swift index f5b9465..93317ec 100644 --- a/Emojr/EmojiSlotMachine.swift +++ b/Emojr/EmojiSlotMachine.swift @@ -66,7 +66,7 @@ class EmojiSlotMachine: UIView { label.text = emojis[randomNumba] } - func randomizeLabels() { + @objc func randomizeLabels() { for label in emojiStackView.arrangedSubviews { if let label = label as? UILabel { randomize(label: label) diff --git a/Emojr/LoginManager.swift b/Emojr/LoginManager.swift index 2ab58d6..9c01d03 100644 --- a/Emojr/LoginManager.swift +++ b/Emojr/LoginManager.swift @@ -144,7 +144,7 @@ class LoginManager: NSObject { navController.navigationBar.barTintColor = blue navController.navigationBar.tintColor = UIColor.white - navController.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white] + navController.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor : UIColor.white] navController.navigationBar.isTranslucent = false } diff --git a/Emojr/TimelineViewController.swift b/Emojr/TimelineViewController.swift index 08983d3..a3db383 100644 --- a/Emojr/TimelineViewController.swift +++ b/Emojr/TimelineViewController.swift @@ -99,7 +99,7 @@ class TimelineViewController: UIViewController { } else { let buttonImage = #imageLiteral(resourceName: "writeEmoji").withRenderingMode(.alwaysOriginal) let postButton = UIBarButtonItem(image: buttonImage, style: .plain, target: self, action: #selector(postButtonTapped)) - postButton.setTitleTextAttributes([NSFontAttributeName : UIFont.systemFont(ofSize: 32)], for: UIControlState()) + postButton.setTitleTextAttributes([NSAttributedStringKey.font : UIFont.systemFont(ofSize: 32)], for: UIControlState()) return postButton } @@ -166,7 +166,7 @@ class TimelineViewController: UIViewController { noDataView?.removeFromSuperview() } - func refreshData() { + @objc func refreshData() { tableDataSource.getFirstPage() } @@ -215,7 +215,7 @@ class TimelineViewController: UIViewController { }) } - func dismissPostForm() { + @objc func dismissPostForm() { UIView.animate(withDuration: 0.2, delay: 0, usingSpringWithDamping: 1, @@ -312,7 +312,7 @@ extension TimelineViewController { navigationItem.rightBarButtonItem = rightBarButtonItem() } - func followUser() { + @objc func followUser() { switch type { case .user(let user): followUserManager.startFollowing(user: user, completionBlock: { _ in self.updateFollowButton() }) @@ -320,7 +320,7 @@ extension TimelineViewController { } } - func stopFollowingUser() { + @objc func stopFollowingUser() { switch type { case .user(let user): followUserManager.askToStopFollowingUser(user, presentingViewController: self, completionBlock: { _ in self.updateFollowButton() }) @@ -333,7 +333,7 @@ extension TimelineViewController { // MARK: - Long Tap Gesture extension TimelineViewController { - func longTapOnCell(_ sender: UILongPressGestureRecognizer) { + @objc func longTapOnCell(_ sender: UILongPressGestureRecognizer) { if sender.state == .began { let location = sender.location(in: self.timelineTableView) let indexPath = self.timelineTableView.indexPathForRow(at: location) diff --git a/Emojr/UserListViewController.swift b/Emojr/UserListViewController.swift index be76c60..dc7d63c 100644 --- a/Emojr/UserListViewController.swift +++ b/Emojr/UserListViewController.swift @@ -51,7 +51,7 @@ class UserListViewController: UIViewController { override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) - self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white] + self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor : UIColor.white] } func rightBarButtonItem() -> UIBarButtonItem? { @@ -75,7 +75,7 @@ class UserListViewController: UIViewController { tableView.register(UINib(nibName: "UserTableViewCell", bundle:nil), forCellReuseIdentifier: UserCellIdentifier) } - func refreshData() { + @objc func refreshData() { refreshControl.beginRefreshing() networkFacade.getUsers(completionBlock: userResponseHandler) @@ -104,7 +104,7 @@ class UserListViewController: UIViewController { } } - func navigateToAddBySearch() { + @objc func navigateToAddBySearch() { self.navigationController?.pushViewController(AddUsersViewController(), animated: true) }