From 5bde956e6235522ecbe78e0eef8d6999bd9a68ae Mon Sep 17 00:00:00 2001 From: Candice Date: Sun, 16 Jun 2019 23:58:39 -0500 Subject: [PATCH] none --- ...storyQueryDataToPathHistoryViewModel.swift | 2 +- .../Comments/Html/IssueCommentHtmlCell.swift | 2 +- .../Images/IssueCommentImageCell.swift | 2 +- .../Comments/IssueCommentBaseCell.swift | 4 ++-- .../Comments/Markdown/CMarkParsing.swift | 4 ++-- .../Comments/Markdown/MarkdownAttribute.swift | 22 ++++++++--------- .../Markdown/StyledTextBuilder+NewBase.swift | 2 +- .../Markdown/UIFont+MutableTraits.swift | 2 +- .../Reactions/IssueReactionCell.swift | 8 +++---- Classes/Issues/Commit/IssueCommitCell.swift | 2 +- Classes/Issues/Files/IssueFileCell.swift | 2 +- Classes/Issues/Files/IssueViewFilesCell.swift | 2 +- Classes/Issues/IssueTextActionsView.swift | 2 +- .../Managing/IssueManagingActionCell.swift | 2 +- .../Managing/IssueManagingExpansionCell.swift | 2 +- Classes/Issues/Merge/MergeButton.swift | 8 +++---- .../Issues/Milestone/IssueMilestoneCell.swift | 6 ++--- Classes/Issues/Renamed/IssueRenamedCell.swift | 12 +++++----- .../Review/IssueReviewDetailsCell.swift | 8 +++---- .../StatusEvent/IssueStatusEventCell.swift | 6 ++--- Classes/Labels/LabelMenuCell.swift | 2 +- Classes/Login/SplashView/SplashView.swift | 8 +++---- Classes/Milestones/MilestoneCell.swift | 2 +- .../Notifications/InboxDashboardCell.swift | 8 +++---- Classes/Notifications/NewFeaturesCell.swift | 4 ++-- .../NoNewNotificationsCell.swift | 4 ++-- Classes/Notifications/NotificationCell.swift | 12 +++++----- .../Empty/RepositoryEmptyResultsCell.swift | 2 +- Classes/Repository/RepositoryFileCell.swift | 2 +- .../RepositoryImageViewController.swift | 2 +- .../RepositoryLoadingViewController.swift | 2 +- .../Repository/RepositorySummaryCell.swift | 2 +- .../RepositoryWebViewController.swift | 2 +- Classes/Search/SearchLoadingView.swift | 2 +- Classes/Search/SearchNoResultsCell.swift | 2 +- Classes/Search/SearchRecentCell.swift | 2 +- Classes/Search/SearchRecentViewModel.swift | 2 +- .../LoadMore/LoadMoreCell.swift | 4 ++-- Classes/Settings/SettingsViewController.swift | 4 ++-- Classes/Systems/AppDelegate.swift | 4 ++-- Classes/Systems/AppRouter/Router.swift | 4 ++-- .../Autocomplete/AutocompleteCell.swift | 2 +- .../Autocomplete/AutocompleteType.swift | 2 +- .../Autocomplete/EmojiAutocomplete.swift | 2 +- .../Autocomplete/IssueAutocomplete.swift | 2 +- .../IssueCommentAutocomplete.swift | 2 +- .../Autocomplete/UserAutocomplete.swift | 2 +- Classes/Systems/BadgeNotifications.swift | 4 ++-- Classes/Systems/Feed.swift | 4 ++-- .../Systems/ScrollViewKeyboardAdjuster.swift | 10 ++++---- Classes/Systems/ShortcutHandler.swift | 2 +- .../UIContentSizeCategoryChangeHandler.swift | 2 +- Classes/Utility/Accessibility.swift | 2 +- Classes/Utility/AlertAction.swift | 2 +- Classes/Utility/AlertActionBuilder.swift | 2 +- Classes/Utility/HapticFeedback.swift | 4 ++-- Classes/Utility/Image+Base64.swift | 2 +- .../Utility/LogEnvironmentInformation.swift | 2 +- .../Utility/RepositoryAttributedString.swift | 4 ++-- .../Utility/UIViewController+Routing.swift | 2 +- .../ContrastContextMenu.swift | 4 ++-- .../UINavigationItem+TitleSubtitle.swift | 4 ++-- .../UIViewController+Alerts.swift | 2 +- .../UIViewController+LoadingIndicator.swift | 4 ++-- Classes/Views/EmptyLoadingView.swift | 2 +- Classes/Views/LabelCell.swift | 2 +- Classes/Views/LabelListCell.swift | 2 +- Classes/Views/MarkdownAttributeHandling.swift | 2 +- Classes/Views/MarkdownStyledTextView.swift | 4 ++-- Classes/Views/SelectableCell.swift | 4 ++-- Classes/Views/SpinnerCell.swift | 2 +- Classes/Views/StyledTableCell.swift | 2 +- Classes/Views/Styles.swift | 4 ++-- Classes/Views/TextActionsController.swift | 4 ++-- Classes/Views/UIButton+Label.swift | 2 +- Classes/Views/UISearchBar+Keyboard.swift | 24 +++++++++++++++++++ Freetime.xcodeproj/project.pbxproj | 23 +++++++++--------- FreetimeTests/InboxZeroLoaderTests.swift | 2 +- .../SearchRecentViewModelTests.swift | 4 ++-- .../ReadAllRowController.swift | 2 +- .../RepoInboxRowController.swift | 2 +- 81 files changed, 178 insertions(+), 153 deletions(-) create mode 100644 Classes/Views/UISearchBar+Keyboard.swift diff --git a/Classes/History/RepoFileHistoryQueryDataToPathHistoryViewModel.swift b/Classes/History/RepoFileHistoryQueryDataToPathHistoryViewModel.swift index 195d2fa0..450451cf 100644 --- a/Classes/History/RepoFileHistoryQueryDataToPathHistoryViewModel.swift +++ b/Classes/History/RepoFileHistoryQueryDataToPathHistoryViewModel.swift @@ -28,7 +28,7 @@ extension RepoFileHistoryQuery.Data { let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.paragraphSpacing = 12 paragraphStyle.lineSpacing = 2 - let attributes: [NSAttributedStringKey: Any] = [ + let attributes: [NSAttributedString.Key: Any] = [ .foregroundColor: Styles.Colors.Gray.dark.color, .paragraphStyle: paragraphStyle, .backgroundColor: UIColor.white diff --git a/Classes/Issues/Comments/Html/IssueCommentHtmlCell.swift b/Classes/Issues/Comments/Html/IssueCommentHtmlCell.swift index 0f088f86..01a9a79a 100644 --- a/Classes/Issues/Comments/Html/IssueCommentHtmlCell.swift +++ b/Classes/Issues/Comments/Html/IssueCommentHtmlCell.swift @@ -181,7 +181,7 @@ final class IssueCommentHtmlCell: IssueCommentBaseCell, ListBindable, UIWebViewD // MARK: UIWebViewDelegate - func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool { + func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebView.NavigationType) -> Bool { // if the cell is hidden, its been put back in the reuse pool guard isHidden == false, let url = request.url else { return true } diff --git a/Classes/Issues/Comments/Images/IssueCommentImageCell.swift b/Classes/Issues/Comments/Images/IssueCommentImageCell.swift index faa091b5..557c61b0 100644 --- a/Classes/Issues/Comments/Images/IssueCommentImageCell.swift +++ b/Classes/Issues/Comments/Images/IssueCommentImageCell.swift @@ -28,7 +28,7 @@ final class IssueCommentImageCell: IssueCommentBaseCell, ListBindable { let imageView = FLAnimatedImageView() - private let spinner = UIActivityIndicatorView(activityIndicatorStyle: .gray) + private let spinner = UIActivityIndicatorView(style: .gray) private var tapGesture: UITapGestureRecognizer! override init(frame: CGRect) { diff --git a/Classes/Issues/Comments/IssueCommentBaseCell.swift b/Classes/Issues/Comments/IssueCommentBaseCell.swift index 7b536332..dc049ef1 100644 --- a/Classes/Issues/Comments/IssueCommentBaseCell.swift +++ b/Classes/Issues/Comments/IssueCommentBaseCell.swift @@ -39,7 +39,7 @@ class IssueCommentBaseCell: UICollectionViewCell, UIGestureRecognizerDelegate { collapseButton.setImage(UIImage(named: "bullets").withRenderingMode(.alwaysTemplate), for: .normal) collapseButton.backgroundColor = Styles.Colors.Blue.medium.color - collapseButton.accessibilityTraits = UIAccessibilityTraitNone + collapseButton.accessibilityTraits = .none collapseButton.tintColor = .white collapseButton.titleLabel?.font = Styles.Text.smallTitle.preferredFont collapseButton.isHidden = true @@ -65,7 +65,7 @@ class IssueCommentBaseCell: UICollectionViewCell, UIGestureRecognizerDelegate { if collapseLayer.isHidden == false { contentView.layer.addSublayer(collapseLayer) - contentView.bringSubview(toFront: collapseButton) + contentView.bringSubviewToFront(collapseButton) let collapseFrame = CGRect( x: contentBounds.minX, diff --git a/Classes/Issues/Comments/Markdown/CMarkParsing.swift b/Classes/Issues/Comments/Markdown/CMarkParsing.swift index 58b3bc39..b7b6bec5 100644 --- a/Classes/Issues/Comments/Markdown/CMarkParsing.swift +++ b/Classes/Issues/Comments/Markdown/CMarkParsing.swift @@ -79,12 +79,12 @@ private extension TextElement { children.build(builder, options: options, context: context) case .strikethrough(let children): builder.add(attributes: [ - .strikethroughStyle: NSUnderlineStyle.styleSingle.rawValue, + .strikethroughStyle: NSUnderlineStyle.single.rawValue, .strikethroughColor: builder.tipAttributes?[.foregroundColor] ?? Styles.Colors.Gray.dark.color ]) children.build(builder, options: options, context: context) case .link(let children, _, let url): - var attributes: [NSAttributedStringKey: Any] = [ + var attributes: [NSAttributedString.Key: Any] = [ .foregroundColor: Styles.Colors.Blue.medium.color, .highlight: true ] diff --git a/Classes/Issues/Comments/Markdown/MarkdownAttribute.swift b/Classes/Issues/Comments/Markdown/MarkdownAttribute.swift index 9a6999c0..fae15111 100644 --- a/Classes/Issues/Comments/Markdown/MarkdownAttribute.swift +++ b/Classes/Issues/Comments/Markdown/MarkdownAttribute.swift @@ -9,18 +9,18 @@ import Foundation enum MarkdownAttribute { - static let url = NSAttributedStringKey(rawValue: "com.freetime.Markdown.url-name") - static let email = NSAttributedStringKey(rawValue: "com.freetime.Markdown.email-name") - static let username = NSAttributedStringKey(rawValue: "com.freetime.Markdown.username-name") - static let usernameDisabled = NSAttributedStringKey(rawValue: "com.freetime.Markdown.username-disabled-name") - static let linkShorteningDisabled = NSAttributedStringKey(rawValue: "com.freetime.Markdown.link-shortening-disabled-name") - static let issue = NSAttributedStringKey(rawValue: "com.freetime.Markdown.issue") - static let details = NSAttributedStringKey(rawValue: "com.freetime.Markdown.details") - static let label = NSAttributedStringKey(rawValue: "com.freetime.Markdown.label") - static let commit = NSAttributedStringKey(rawValue: "com.freetime.Markdown.commit") - static let checkbox = NSAttributedStringKey(rawValue: "com.freetime.Markdown.checkbox") + static let url = NSAttributedString.Key(rawValue: "com.freetime.Markdown.url-name") + static let email = NSAttributedString.Key(rawValue: "com.freetime.Markdown.email-name") + static let username = NSAttributedString.Key(rawValue: "com.freetime.Markdown.username-name") + static let usernameDisabled = NSAttributedString.Key(rawValue: "com.freetime.Markdown.username-disabled-name") + static let linkShorteningDisabled = NSAttributedString.Key(rawValue: "com.freetime.Markdown.link-shortening-disabled-name") + static let issue = NSAttributedString.Key(rawValue: "com.freetime.Markdown.issue") + static let details = NSAttributedString.Key(rawValue: "com.freetime.Markdown.details") + static let label = NSAttributedString.Key(rawValue: "com.freetime.Markdown.label") + static let commit = NSAttributedString.Key(rawValue: "com.freetime.Markdown.commit") + static let checkbox = NSAttributedString.Key(rawValue: "com.freetime.Markdown.checkbox") - static let all = Set([ + static let all = Set([ url, email, username, diff --git a/Classes/Issues/Comments/Markdown/StyledTextBuilder+NewBase.swift b/Classes/Issues/Comments/Markdown/StyledTextBuilder+NewBase.swift index 5b239d3e..ab8a212f 100644 --- a/Classes/Issues/Comments/Markdown/StyledTextBuilder+NewBase.swift +++ b/Classes/Issues/Comments/Markdown/StyledTextBuilder+NewBase.swift @@ -14,7 +14,7 @@ extension StyledTextBuilder { let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.paragraphSpacing = 12 paragraphStyle.lineSpacing = 2 - let attributes: [NSAttributedStringKey: Any] = [ + let attributes: [NSAttributedString.Key: Any] = [ .foregroundColor: Styles.Colors.Gray.dark.color, .paragraphStyle: paragraphStyle, .backgroundColor: UIColor.white diff --git a/Classes/Issues/Comments/Markdown/UIFont+MutableTraits.swift b/Classes/Issues/Comments/Markdown/UIFont+MutableTraits.swift index 98022355..752f83ff 100644 --- a/Classes/Issues/Comments/Markdown/UIFont+MutableTraits.swift +++ b/Classes/Issues/Comments/Markdown/UIFont+MutableTraits.swift @@ -10,7 +10,7 @@ import UIKit extension UIFont { - func addingTraits(traits: UIFontDescriptorSymbolicTraits) -> UIFont { + func addingTraits(traits: UIFontDescriptor.SymbolicTraits) -> UIFont { let newTraits = fontDescriptor.symbolicTraits.union(traits) guard let descriptor = fontDescriptor.withSymbolicTraits(newTraits) else { return self } diff --git a/Classes/Issues/Comments/Reactions/IssueReactionCell.swift b/Classes/Issues/Comments/Reactions/IssueReactionCell.swift index 788a57d2..e1531dd3 100644 --- a/Classes/Issues/Comments/Reactions/IssueReactionCell.swift +++ b/Classes/Issues/Comments/Reactions/IssueReactionCell.swift @@ -35,7 +35,7 @@ final class IssueReactionCell: UICollectionViewCell { override init(frame: CGRect) { super.init(frame: frame) - accessibilityTraits |= UIAccessibilityTraitButton + accessibilityTraits.insert(.button) isAccessibilityElement = true emojiLabel.textAlignment = .center @@ -122,9 +122,9 @@ final class IssueReactionCell: UICollectionViewCell { func iterate(add: Bool) { let animation = CATransition() animation.duration = 0.25 - animation.type = kCATransitionPush - animation.subtype = add ? kCATransitionFromTop : kCATransitionFromBottom - animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) + animation.type = .push + animation.subtype = add ? .fromTop : .fromBottom + animation.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) countLabel.layer.add(animation, forKey: "text-change") } diff --git a/Classes/Issues/Commit/IssueCommitCell.swift b/Classes/Issues/Commit/IssueCommitCell.swift index fd4295fe..928caefd 100644 --- a/Classes/Issues/Commit/IssueCommitCell.swift +++ b/Classes/Issues/Commit/IssueCommitCell.swift @@ -25,7 +25,7 @@ final class IssueCommitCell: UICollectionViewCell { override init(frame: CGRect) { super.init(frame: frame) isAccessibilityElement = true - accessibilityTraits = UIAccessibilityTraitButton + accessibilityTraits = .button commitImageView.contentMode = .scaleAspectFit commitImageView.tintColor = Styles.Colors.Gray.light.color diff --git a/Classes/Issues/Files/IssueFileCell.swift b/Classes/Issues/Files/IssueFileCell.swift index a7e54b8f..297f147a 100644 --- a/Classes/Issues/Files/IssueFileCell.swift +++ b/Classes/Issues/Files/IssueFileCell.swift @@ -57,7 +57,7 @@ final class IssueFileCell: SelectableCell { func configure(path: String, additions: Int, deletions: Int, disclosureHidden: Bool) { let changeString = NSMutableAttributedString() - var attributes: [NSAttributedStringKey: Any] = [ + var attributes: [NSAttributedString.Key: Any] = [ .font: Styles.Text.secondaryBold.preferredFont ] diff --git a/Classes/Issues/Files/IssueViewFilesCell.swift b/Classes/Issues/Files/IssueViewFilesCell.swift index 4a492051..44a52066 100644 --- a/Classes/Issues/Files/IssueViewFilesCell.swift +++ b/Classes/Issues/Files/IssueViewFilesCell.swift @@ -16,7 +16,7 @@ final class IssueViewFilesCell: UICollectionViewCell { override init(frame: CGRect) { super.init(frame: frame) isAccessibilityElement = true - accessibilityTraits |= UIAccessibilityTraitButton + accessibilityTraits.insert(.button) contentView.addSubview(label) label.snp.makeConstraints { make in diff --git a/Classes/Issues/IssueTextActionsView.swift b/Classes/Issues/IssueTextActionsView.swift index 75cb6e9a..e07bb821 100644 --- a/Classes/Issues/IssueTextActionsView.swift +++ b/Classes/Issues/IssueTextActionsView.swift @@ -95,7 +95,7 @@ final class IssueTextActionsView: UIView, UICollectionViewDataSource, UICollecti private let sendButtonGradientLayer = CAGradientLayer() private let sendButton = UIButton() private let activityIndicator = UIActivityIndicatorView( - activityIndicatorStyle: UIActivityIndicatorViewStyle.gray + style: .gray ) public var sendButtonEnabled: Bool { diff --git a/Classes/Issues/Managing/IssueManagingActionCell.swift b/Classes/Issues/Managing/IssueManagingActionCell.swift index 566d1a00..80e47a0b 100644 --- a/Classes/Issues/Managing/IssueManagingActionCell.swift +++ b/Classes/Issues/Managing/IssueManagingActionCell.swift @@ -20,7 +20,7 @@ final class IssueManagingActionCell: UICollectionViewCell, ListBindable { override init(frame: CGRect) { super.init(frame: frame) - accessibilityTraits |= UIAccessibilityTraitButton + accessibilityTraits.insert(.button) isAccessibilityElement = true let tint = Styles.Colors.Blue.medium.color diff --git a/Classes/Issues/Managing/IssueManagingExpansionCell.swift b/Classes/Issues/Managing/IssueManagingExpansionCell.swift index 657e341f..930e3978 100644 --- a/Classes/Issues/Managing/IssueManagingExpansionCell.swift +++ b/Classes/Issues/Managing/IssueManagingExpansionCell.swift @@ -25,7 +25,7 @@ final class IssueManagingExpansionCell: UICollectionViewCell, ListBindable { override init(frame: CGRect) { super.init(frame: frame) - accessibilityTraits |= UIAccessibilityTraitButton + accessibilityTraits.insert(.button) isAccessibilityElement = true backgroundHighlightView.backgroundColor = UIColor(white: 0, alpha: 0.07) diff --git a/Classes/Issues/Merge/MergeButton.swift b/Classes/Issues/Merge/MergeButton.swift index 79f26301..9c306a15 100644 --- a/Classes/Issues/Merge/MergeButton.swift +++ b/Classes/Issues/Merge/MergeButton.swift @@ -23,7 +23,7 @@ final class MergeButton: UIControl { private let mergeLabel = UILabel() private let optionBorder = UIView() - private let activityView = UIActivityIndicatorView(activityIndicatorStyle: .gray) + private let activityView = UIActivityIndicatorView(style: .gray) private let gradientLayer = CAGradientLayer() override init(frame: CGRect) { @@ -50,7 +50,7 @@ final class MergeButton: UIControl { optionButton.imageView?.contentMode = .center optionButton.setImage(image, for: .normal) optionButton.isAccessibilityElement = true - optionButton.accessibilityTraits = UIAccessibilityTraitButton + optionButton.accessibilityTraits = .button optionButton.addTarget(self, action: #selector(onOptionsTouch), for: .touchUpInside) optionButton.snp.makeConstraints { make in make.top.right.bottom.equalToSuperview() @@ -108,7 +108,7 @@ final class MergeButton: UIControl { layer.addSublayer(gradientLayer) [mergeLabel, optionButton, optionBorder, activityView].forEach { - bringSubview(toFront: $0) + bringSubviewToFront($0) } } else { gradientLayer.removeFromSuperlayer() @@ -147,7 +147,7 @@ final class MergeButton: UIControl { height: bounds.size.height ) ) - element.accessibilityTraits |= UIAccessibilityTraitButton + element.accessibilityTraits.insert(.button) return element } diff --git a/Classes/Issues/Milestone/IssueMilestoneCell.swift b/Classes/Issues/Milestone/IssueMilestoneCell.swift index f64e8419..90f9d069 100644 --- a/Classes/Issues/Milestone/IssueMilestoneCell.swift +++ b/Classes/Issues/Milestone/IssueMilestoneCell.swift @@ -17,7 +17,7 @@ final class IssueMilestoneCell: UICollectionViewCell { override init(frame: CGRect) { super.init(frame: frame) isAccessibilityElement = true - accessibilityTraits |= UIAccessibilityTraitButton + accessibilityTraits.insert(.button) titleLabel.backgroundColor = .clear contentView.addSubview(titleLabel) @@ -51,7 +51,7 @@ final class IssueMilestoneCell: UICollectionViewCell { // MARK: Public API func configure(milestone: Milestone) { - let milestoneAttributes: [NSAttributedStringKey: Any] = [ + let milestoneAttributes: [NSAttributedString.Key: Any] = [ .foregroundColor: Styles.Colors.Gray.light.color, .font: Styles.Text.secondary.preferredFont ] @@ -59,7 +59,7 @@ final class IssueMilestoneCell: UICollectionViewCell { string: NSLocalizedString("Milestone: ", comment: ""), attributes: milestoneAttributes ) - let titleAttributes: [NSAttributedStringKey: Any] = [ + let titleAttributes: [NSAttributedString.Key: Any] = [ .foregroundColor: Styles.Colors.Gray.dark.color, .font: Styles.Text.secondaryBold.preferredFont ] diff --git a/Classes/Issues/Renamed/IssueRenamedCell.swift b/Classes/Issues/Renamed/IssueRenamedCell.swift index 456e7b61..80f73c66 100644 --- a/Classes/Issues/Renamed/IssueRenamedCell.swift +++ b/Classes/Issues/Renamed/IssueRenamedCell.swift @@ -70,14 +70,14 @@ final class IssueRenamedCell: UICollectionViewCell { // MARK: Public API func configure(_ model: IssueRenamedModel) { - let actorAttributes = [ - NSAttributedStringKey.font: Styles.Text.secondaryBold.preferredFont, - NSAttributedStringKey.foregroundColor: Styles.Colors.Gray.dark.color + let actorAttributes: [NSAttributedString.Key: Any] = [ + .font: Styles.Text.secondaryBold.preferredFont, + .foregroundColor: Styles.Colors.Gray.dark.color ] let actor = NSMutableAttributedString(string: model.actor, attributes: actorAttributes) - let referencedAttributes = [ - NSAttributedStringKey.font: Styles.Text.secondary.preferredFont, - NSAttributedStringKey.foregroundColor: Styles.Colors.Gray.medium.color + let referencedAttributes: [NSAttributedString.Key: Any] = [ + .font: Styles.Text.secondary.preferredFont, + .foregroundColor: Styles.Colors.Gray.medium.color ] actor.append(NSAttributedString( string: NSLocalizedString(" renamed", comment: ""), diff --git a/Classes/Issues/Review/IssueReviewDetailsCell.swift b/Classes/Issues/Review/IssueReviewDetailsCell.swift index e5665146..655d9181 100644 --- a/Classes/Issues/Review/IssueReviewDetailsCell.swift +++ b/Classes/Issues/Review/IssueReviewDetailsCell.swift @@ -105,13 +105,13 @@ final class IssueReviewDetailsCell: IssueCommentBaseCell, ListBindable { icon.tintColor = iconTintColor icon.image = UIImage(named: iconName)?.withRenderingMode(.alwaysTemplate) - var attributes = [ - NSAttributedStringKey.font: Styles.Text.title.preferredFont, - NSAttributedStringKey.foregroundColor: Styles.Colors.Gray.medium.color + var attributes: [NSAttributedString.Key: Any] = [ + .font: Styles.Text.title.preferredFont, + .foregroundColor: Styles.Colors.Gray.medium.color ] let mActorString = NSMutableAttributedString(string: viewModel.actor, attributes: attributes) - attributes[NSAttributedStringKey.font] = Styles.Text.secondary.preferredFont + attributes[.font] = Styles.Text.secondary.preferredFont mActorString.append(NSAttributedString(string: " \(action)", attributes: attributes)) actorButton.setAttributedTitle(mActorString, for: .normal) } diff --git a/Classes/Issues/StatusEvent/IssueStatusEventCell.swift b/Classes/Issues/StatusEvent/IssueStatusEventCell.swift index 6a7f1f4d..556c45a5 100644 --- a/Classes/Issues/StatusEvent/IssueStatusEventCell.swift +++ b/Classes/Issues/StatusEvent/IssueStatusEventCell.swift @@ -85,9 +85,9 @@ final class IssueStatusEventCell: UICollectionViewCell { // MARK: Public API func configure(_ model: IssueStatusEventModel) { - let actorAttributes = [ - NSAttributedStringKey.foregroundColor: Styles.Colors.Gray.dark.color, - NSAttributedStringKey.font: Styles.Text.secondaryBold.preferredFont + let actorAttributes: [NSAttributedString.Key: Any] = [ + .foregroundColor: Styles.Colors.Gray.dark.color, + .font: Styles.Text.secondaryBold.preferredFont ] actorButton.setAttributedTitle(NSAttributedString(string: model.actor, attributes: actorAttributes), for: .normal) diff --git a/Classes/Labels/LabelMenuCell.swift b/Classes/Labels/LabelMenuCell.swift index 8a300bc8..58c13888 100644 --- a/Classes/Labels/LabelMenuCell.swift +++ b/Classes/Labels/LabelMenuCell.swift @@ -22,7 +22,7 @@ final class LabelMenuCell: SelectableCell { contentView.backgroundColor = nil isAccessibilityElement = true - accessibilityTraits |= UIAccessibilityTraitButton + accessibilityTraits.insert(.button) contentView.addSubview(checkedImageView) checkedImageView.tintColor = Styles.Colors.Blue.menu.color diff --git a/Classes/Login/SplashView/SplashView.swift b/Classes/Login/SplashView/SplashView.swift index 421c377e..76ab3453 100644 --- a/Classes/Login/SplashView/SplashView.swift +++ b/Classes/Login/SplashView/SplashView.swift @@ -59,8 +59,8 @@ final class SplashView: UIView { pulseAnimation.fromValue = 1.0 pulseAnimation.toValue = 0.9 pulseAnimation.duration = 2 - pulseAnimation.fillMode = kCAFillModeForwards - pulseAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) + pulseAnimation.fillMode = .forwards + pulseAnimation.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) birdImageView.layer.add(pulseAnimation, forKey: "scaling") } @@ -71,8 +71,8 @@ final class SplashView: UIView { rotateAnimation.repeatCount = .infinity rotateAnimation.byValue = 2 * Double.pi rotateAnimation.duration = 120 - rotateAnimation.fillMode = kCAFillModeForwards - rotateAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear) + rotateAnimation.fillMode = .forwards + rotateAnimation.timingFunction = CAMediaTimingFunction(name: .linear) branchesImageView.layer.add(rotateAnimation, forKey: "rotation") } diff --git a/Classes/Milestones/MilestoneCell.swift b/Classes/Milestones/MilestoneCell.swift index 9e0fe2df..8868dd0f 100644 --- a/Classes/Milestones/MilestoneCell.swift +++ b/Classes/Milestones/MilestoneCell.swift @@ -23,7 +23,7 @@ final class MilestoneCell2: SelectableCell { contentView.backgroundColor = nil isAccessibilityElement = true - accessibilityTraits |= UIAccessibilityTraitButton + accessibilityTraits.insert(.button) contentView.addSubview(checkedImageView) checkedImageView.tintColor = Styles.Colors.Blue.menu.color diff --git a/Classes/Notifications/InboxDashboardCell.swift b/Classes/Notifications/InboxDashboardCell.swift index 9dcc8658..47fd19f4 100644 --- a/Classes/Notifications/InboxDashboardCell.swift +++ b/Classes/Notifications/InboxDashboardCell.swift @@ -27,7 +27,7 @@ final class InboxDashboardCell: SelectableCell { override init(frame: CGRect) { super.init(frame: frame) - accessibilityTraits |= UIAccessibilityTraitButton + accessibilityTraits.insert(.button) isAccessibilityElement = true backgroundColor = .white @@ -84,9 +84,9 @@ final class InboxDashboardCell: SelectableCell { textView.configure(with: model.text, width: contentView.bounds.width) dateLabel.setText(date: model.date, format: .short) - var titleAttributes = [ - NSAttributedStringKey.font: Styles.Text.title.preferredFont, - NSAttributedStringKey.foregroundColor: Styles.Colors.Gray.light.color + var titleAttributes: [NSAttributedString.Key: Any] = [ + .font: Styles.Text.title.preferredFont, + .foregroundColor: Styles.Colors.Gray.light.color ] let title = NSMutableAttributedString(string: "\(model.owner)/\(model.name) ", attributes: titleAttributes) titleAttributes[.font] = Styles.Text.secondary.preferredFont diff --git a/Classes/Notifications/NewFeaturesCell.swift b/Classes/Notifications/NewFeaturesCell.swift index 5c63da64..69e415da 100644 --- a/Classes/Notifications/NewFeaturesCell.swift +++ b/Classes/Notifications/NewFeaturesCell.swift @@ -71,12 +71,12 @@ final class NewFeaturesCell: UICollectionViewCell { override func layoutSubviews() { super.layoutSubviews() - contentView.frame = UIEdgeInsetsInsetRect(CGRect( + contentView.frame = CGRect( x: safeAreaInsets.left, y: bounds.minY, width: bounds.width - safeAreaInsets.left - safeAreaInsets.right, height: bounds.height - ), NewFeaturesCell.inset) + ).inset(by: NewFeaturesCell.inset) } @objc private func onCloseButton() { diff --git a/Classes/Notifications/NoNewNotificationsCell.swift b/Classes/Notifications/NoNewNotificationsCell.swift index 58beadcd..09a8cb51 100644 --- a/Classes/Notifications/NoNewNotificationsCell.swift +++ b/Classes/Notifications/NoNewNotificationsCell.swift @@ -55,7 +55,7 @@ final class NoNewNotificationsCell: UICollectionViewCell { NotificationCenter.default .addObserver(self, selector: #selector(resetAnimations), - name: .UIApplicationWillEnterForeground, + name: UIApplication.willEnterForegroundNotification, object: nil ) @@ -132,7 +132,7 @@ final class NoNewNotificationsCell: UICollectionViewCell { @objc private func resetAnimations() { guard trueUnlessReduceMotionEnabled else { return } - let timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) + let timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) let duration: TimeInterval = 1 let emojiBounce = CABasicAnimation(keyPath: "transform.translation.y") diff --git a/Classes/Notifications/NotificationCell.swift b/Classes/Notifications/NotificationCell.swift index 50447c90..1ef90ab3 100644 --- a/Classes/Notifications/NotificationCell.swift +++ b/Classes/Notifications/NotificationCell.swift @@ -43,7 +43,7 @@ final class NotificationCell: SelectableCell, CAAnimationDelegate { override init(frame: CGRect) { super.init(frame: frame) - accessibilityTraits |= UIAccessibilityTraitButton + accessibilityTraits.insert(.button) isAccessibilityElement = true backgroundColor = .white @@ -163,9 +163,9 @@ final class NotificationCell: SelectableCell, CAAnimationDelegate { dateLabel.setText(date: model.date, format: .short) self.delegate = delegate - var titleAttributes = [ - NSAttributedStringKey.font: Styles.Text.title.preferredFont, - NSAttributedStringKey.foregroundColor: Styles.Colors.Gray.light.color + var titleAttributes: [NSAttributedString.Key: Any] = [ + .font: Styles.Text.title.preferredFont, + .foregroundColor: Styles.Colors.Gray.light.color ] let title = NSMutableAttributedString(string: "\(model.owner)/\(model.repo) ", attributes: titleAttributes) titleAttributes[.font] = Styles.Text.secondary.preferredFont @@ -263,12 +263,12 @@ final class NotificationCell: SelectableCell, CAAnimationDelegate { let scale = CABasicAnimation(keyPath: "transform.scale") scale.fromValue = 1 scale.duration = scaleDuration - scale.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear) + scale.timingFunction = CAMediaTimingFunction(name: .linear) let fade = CABasicAnimation(keyPath: "opacity") fade.fromValue = 0 fade.duration = 0.05 - fade.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear) + fade.timingFunction = CAMediaTimingFunction(name: .linear) let group = CAAnimationGroup() group.duration = scaleDuration diff --git a/Classes/Repository/Empty/RepositoryEmptyResultsCell.swift b/Classes/Repository/Empty/RepositoryEmptyResultsCell.swift index 27846c68..0a4cc88c 100644 --- a/Classes/Repository/Empty/RepositoryEmptyResultsCell.swift +++ b/Classes/Repository/Empty/RepositoryEmptyResultsCell.swift @@ -18,7 +18,7 @@ final class RepositoryEmptyResultsCell: UICollectionViewCell { override init(frame: CGRect) { super.init(frame: frame) - accessibilityTraits |= UIAccessibilityTraitStaticText + accessibilityTraits.insert(.staticText) isAccessibilityElement = true let tint = Styles.Colors.Gray.light.color diff --git a/Classes/Repository/RepositoryFileCell.swift b/Classes/Repository/RepositoryFileCell.swift index 45703e2f..0c8e68cb 100644 --- a/Classes/Repository/RepositoryFileCell.swift +++ b/Classes/Repository/RepositoryFileCell.swift @@ -19,7 +19,7 @@ final class RepositoryFileCell: SelectableCell { super.init(frame: frame) isAccessibilityElement = true - accessibilityTraits |= UIAccessibilityTraitButton + accessibilityTraits.insert(.button) backgroundColor = .white disclosure.tintColor = Styles.Colors.Gray.light.color diff --git a/Classes/Repository/RepositoryImageViewController.swift b/Classes/Repository/RepositoryImageViewController.swift index 1a34e2af..0c8ecd2d 100644 --- a/Classes/Repository/RepositoryImageViewController.swift +++ b/Classes/Repository/RepositoryImageViewController.swift @@ -22,7 +22,7 @@ UIScrollViewDelegate { private let emptyView = EmptyView() private let scrollView = UIScrollView() private let imageView = FLAnimatedImageView() - private let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray) + private let activityIndicator = UIActivityIndicatorView(style: .gray) private var imageUrl: URL? { let builder = URLBuilder.github() .add(path: repo.owner) diff --git a/Classes/Repository/RepositoryLoadingViewController.swift b/Classes/Repository/RepositoryLoadingViewController.swift index 5798a784..99c42d7d 100644 --- a/Classes/Repository/RepositoryLoadingViewController.swift +++ b/Classes/Repository/RepositoryLoadingViewController.swift @@ -13,7 +13,7 @@ import XLPagerTabStrip final class RepositoryLoadingViewController: UIViewController, IndicatorInfoProvider { - private let spinner = UIActivityIndicatorView(activityIndicatorStyle: .gray) + private let spinner = UIActivityIndicatorView(style: .gray) override func viewDidLoad() { super.viewDidLoad() diff --git a/Classes/Repository/RepositorySummaryCell.swift b/Classes/Repository/RepositorySummaryCell.swift index 6734991c..b1ba0559 100644 --- a/Classes/Repository/RepositorySummaryCell.swift +++ b/Classes/Repository/RepositorySummaryCell.swift @@ -28,7 +28,7 @@ final class RepositorySummaryCell: SelectableCell { override init(frame: CGRect) { super.init(frame: frame) - accessibilityTraits |= UIAccessibilityTraitButton + accessibilityTraits.insert(.button) isAccessibilityElement = true backgroundColor = .white diff --git a/Classes/Repository/RepositoryWebViewController.swift b/Classes/Repository/RepositoryWebViewController.swift index d12b45e4..858df8d6 100644 --- a/Classes/Repository/RepositoryWebViewController.swift +++ b/Classes/Repository/RepositoryWebViewController.swift @@ -66,7 +66,7 @@ final class RepositoryWebViewController: UIViewController { private let emptyView = EmptyView() private lazy var activityIndicator: UIActivityIndicatorView = { - let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray) + let activityIndicator = UIActivityIndicatorView(style: .gray) activityIndicator.hidesWhenStopped = true return activityIndicator diff --git a/Classes/Search/SearchLoadingView.swift b/Classes/Search/SearchLoadingView.swift index 7f2521d0..c99bd8d3 100644 --- a/Classes/Search/SearchLoadingView.swift +++ b/Classes/Search/SearchLoadingView.swift @@ -11,7 +11,7 @@ import SnapKit final class SearchLoadingView: UIView { - private let activity = UIActivityIndicatorView(activityIndicatorStyle: .gray) + private let activity = UIActivityIndicatorView(style: .gray) override init(frame: CGRect) { super.init(frame: frame) diff --git a/Classes/Search/SearchNoResultsCell.swift b/Classes/Search/SearchNoResultsCell.swift index b4dc466a..28c1c97a 100644 --- a/Classes/Search/SearchNoResultsCell.swift +++ b/Classes/Search/SearchNoResultsCell.swift @@ -18,7 +18,7 @@ final class SearchNoResultsCell: UICollectionViewCell { override init(frame: CGRect) { super.init(frame: frame) - accessibilityTraits |= UIAccessibilityTraitStaticText + accessibilityTraits.insert(.staticText) isAccessibilityElement = true emoji.text = "😞" diff --git a/Classes/Search/SearchRecentCell.swift b/Classes/Search/SearchRecentCell.swift index ee188b89..e2d26613 100644 --- a/Classes/Search/SearchRecentCell.swift +++ b/Classes/Search/SearchRecentCell.swift @@ -16,7 +16,7 @@ final class SearchRecentCell: SwipeSelectableCell { override init(frame: CGRect) { super.init(frame: frame) - accessibilityTraits |= UIAccessibilityTraitButton + accessibilityTraits.insert(.button) isAccessibilityElement = true backgroundColor = .white diff --git a/Classes/Search/SearchRecentViewModel.swift b/Classes/Search/SearchRecentViewModel.swift index ff4a214b..f457a249 100644 --- a/Classes/Search/SearchRecentViewModel.swift +++ b/Classes/Search/SearchRecentViewModel.swift @@ -59,7 +59,7 @@ final class SearchRecentViewModel: NSObject, ListDiffable { // MARK: Private API - private var standardAttributes: [NSAttributedStringKey: Any] { + private var standardAttributes: [NSAttributedString.Key: Any] { return [ .font: Styles.Text.body.preferredFont, .foregroundColor: Styles.Colors.Gray.dark.color diff --git a/Classes/Section Controllers/LoadMore/LoadMoreCell.swift b/Classes/Section Controllers/LoadMore/LoadMoreCell.swift index 89355ac7..cdd9295b 100644 --- a/Classes/Section Controllers/LoadMore/LoadMoreCell.swift +++ b/Classes/Section Controllers/LoadMore/LoadMoreCell.swift @@ -12,13 +12,13 @@ import IGListKit final class LoadMoreCell: SelectableCell { - private let activity = UIActivityIndicatorView(activityIndicatorStyle: .gray) + private let activity = UIActivityIndicatorView(style: .gray) private let label = UILabel() override init(frame: CGRect) { super.init(frame: frame) - accessibilityTraits |= UIAccessibilityTraitButton + accessibilityTraits.insert(.button) isAccessibilityElement = true label.font = Styles.Text.button.preferredFont label.textColor = Styles.Colors.Blue.medium.color diff --git a/Classes/Settings/SettingsViewController.swift b/Classes/Settings/SettingsViewController.swift index abae1ec4..5617625e 100644 --- a/Classes/Settings/SettingsViewController.swift +++ b/Classes/Settings/SettingsViewController.swift @@ -64,7 +64,7 @@ GitHubSessionListener { NotificationCenter.default.addObserver( self, selector: #selector(SettingsViewController.updateBadge), - name: .UIApplicationDidBecomeActive, + name: UIApplication.didBecomeActiveNotification, object: nil ) } @@ -271,7 +271,7 @@ GitHubSessionListener { } @IBAction private func onSettings(_ sender: Any) { - guard let url = URL(string: UIApplicationOpenSettingsURLString) else { return } + guard let url = URL(string: UIApplication.openSettingsURLString) else { return } UIApplication.shared.open(url) } diff --git a/Classes/Systems/AppDelegate.swift b/Classes/Systems/AppDelegate.swift index 9ec18061..0bff5374 100644 --- a/Classes/Systems/AppDelegate.swift +++ b/Classes/Systems/AppDelegate.swift @@ -20,7 +20,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { private let flexController = FlexController() private let appController = AppController() - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { appController.appDidFinishLaunching(with: window) @@ -63,7 +63,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { appController.performFetch(application: application, with: completionHandler) } - func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool { + func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { return appController.router.handle(url: url).wasHandled } diff --git a/Classes/Systems/AppRouter/Router.swift b/Classes/Systems/AppRouter/Router.swift index 2ebc2fda..df44d7da 100644 --- a/Classes/Systems/AppRouter/Router.swift +++ b/Classes/Systems/AppRouter/Router.swift @@ -38,7 +38,7 @@ extension UIViewController { return } - let originalSelector = #selector(addChildViewController(_:)) + let originalSelector = #selector(addChild) let swizzledSelector = #selector(swizzle_addChildViewController(_:)) guard let originalMethod = class_getInstanceMethod(self, originalSelector), @@ -75,7 +75,7 @@ extension UIViewController { .OBJC_ASSOCIATION_RETAIN_NONATOMIC ) // recursively set to all VCs - childViewControllers.forEach { $0.router = newValue } + children.forEach { $0.router = newValue } } } diff --git a/Classes/Systems/Autocomplete/AutocompleteCell.swift b/Classes/Systems/Autocomplete/AutocompleteCell.swift index 3adaaf6b..5b9eb419 100644 --- a/Classes/Systems/Autocomplete/AutocompleteCell.swift +++ b/Classes/Systems/Autocomplete/AutocompleteCell.swift @@ -23,7 +23,7 @@ final class AutocompleteCell: StyledTableCell { private let emojiLabel = UILabel() private let titleLabel = UILabel() - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) thumbnailImageView.contentMode = .scaleAspectFill diff --git a/Classes/Systems/Autocomplete/AutocompleteType.swift b/Classes/Systems/Autocomplete/AutocompleteType.swift index 004f6649..55a83fdc 100644 --- a/Classes/Systems/Autocomplete/AutocompleteType.swift +++ b/Classes/Systems/Autocomplete/AutocompleteType.swift @@ -20,6 +20,6 @@ protocol AutocompleteType { func accept(index: Int) -> String? - var highlightAttributes: [NSAttributedStringKey: Any]? { get } + var highlightAttributes: [NSAttributedString.Key: Any]? { get } } diff --git a/Classes/Systems/Autocomplete/EmojiAutocomplete.swift b/Classes/Systems/Autocomplete/EmojiAutocomplete.swift index 711a37a3..de77e1d5 100644 --- a/Classes/Systems/Autocomplete/EmojiAutocomplete.swift +++ b/Classes/Systems/Autocomplete/EmojiAutocomplete.swift @@ -59,6 +59,6 @@ final class EmojiAutocomplete: AutocompleteType { return results[index].emoji } - var highlightAttributes: [NSAttributedStringKey: Any]? { return nil } + var highlightAttributes: [NSAttributedString.Key: Any]? { return nil } } diff --git a/Classes/Systems/Autocomplete/IssueAutocomplete.swift b/Classes/Systems/Autocomplete/IssueAutocomplete.swift index 79fed3da..bf068391 100644 --- a/Classes/Systems/Autocomplete/IssueAutocomplete.swift +++ b/Classes/Systems/Autocomplete/IssueAutocomplete.swift @@ -87,6 +87,6 @@ final class IssueAutocomplete: AutocompleteType { return prefix + "\(results[index].number)" } - var highlightAttributes: [NSAttributedStringKey: Any]? { return nil } + var highlightAttributes: [NSAttributedString.Key: Any]? { return nil } } diff --git a/Classes/Systems/Autocomplete/IssueCommentAutocomplete.swift b/Classes/Systems/Autocomplete/IssueCommentAutocomplete.swift index 027b7332..f530548c 100644 --- a/Classes/Systems/Autocomplete/IssueCommentAutocomplete.swift +++ b/Classes/Systems/Autocomplete/IssueCommentAutocomplete.swift @@ -46,7 +46,7 @@ final class IssueCommentAutocomplete { return map.map { $0.key } } - func highlightAttributes(prefix: String) -> [NSAttributedStringKey: Any]? { + func highlightAttributes(prefix: String) -> [NSAttributedString.Key: Any]? { return map[prefix]?.highlightAttributes } diff --git a/Classes/Systems/Autocomplete/UserAutocomplete.swift b/Classes/Systems/Autocomplete/UserAutocomplete.swift index 7ba8dcae..fd4a3dc8 100644 --- a/Classes/Systems/Autocomplete/UserAutocomplete.swift +++ b/Classes/Systems/Autocomplete/UserAutocomplete.swift @@ -64,7 +64,7 @@ final class UserAutocomplete: AutocompleteType { return prefix + results[index].login } - var highlightAttributes: [NSAttributedStringKey: Any]? { + var highlightAttributes: [NSAttributedString.Key: Any]? { return [ .foregroundColor: Styles.Colors.Blue.medium.color, .backgroundColor: Styles.Colors.Blue.medium.color.withAlphaComponent(0.1) diff --git a/Classes/Systems/BadgeNotifications.swift b/Classes/Systems/BadgeNotifications.swift index 64887a11..527f209f 100644 --- a/Classes/Systems/BadgeNotifications.swift +++ b/Classes/Systems/BadgeNotifications.swift @@ -70,9 +70,9 @@ final class BadgeNotifications { UNUserNotificationCenter.current().requestAuthorization(options: options, completionHandler: { (granted, _) in permissionHandler?(granted) }) - application.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum) + application.setMinimumBackgroundFetchInterval(UIApplication.backgroundFetchIntervalMinimum) } else { - application.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalNever) + application.setMinimumBackgroundFetchInterval(UIApplication.backgroundFetchIntervalNever) } } diff --git a/Classes/Systems/Feed.swift b/Classes/Systems/Feed.swift index b830d9ef..c9629d59 100644 --- a/Classes/Systems/Feed.swift +++ b/Classes/Systems/Feed.swift @@ -67,13 +67,13 @@ final class Feed: NSObject, UIScrollViewDelegate { center.addObserver( self, selector: #selector(didBecomeActive), - name: .UIApplicationDidBecomeActive, + name: UIApplication.didBecomeActiveNotification, object: nil ) center.addObserver( self, selector: #selector(willResignActive), - name: .UIApplicationWillResignActive, + name: UIApplication.willResignActiveNotification, object: nil ) } diff --git a/Classes/Systems/ScrollViewKeyboardAdjuster.swift b/Classes/Systems/ScrollViewKeyboardAdjuster.swift index d80e2e6f..aa535e08 100644 --- a/Classes/Systems/ScrollViewKeyboardAdjuster.swift +++ b/Classes/Systems/ScrollViewKeyboardAdjuster.swift @@ -23,13 +23,13 @@ final class ScrollViewKeyboardAdjuster { nc.addObserver( self, selector: #selector(onKeyboardWillShow(notification:)), - name: .UIKeyboardWillShow, + name: UIResponder.keyboardWillShowNotification, object: nil ) nc.addObserver( self, selector: #selector(onKeyboardWillHide(notification:)), - name: .UIKeyboardWillHide, + name: UIResponder.keyboardWillHideNotification, object: nil ) } @@ -38,8 +38,8 @@ final class ScrollViewKeyboardAdjuster { @objc func onKeyboardWillShow(notification: NSNotification) { guard !keyboardIsShowing, - let frame = notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? CGRect, - let duration = notification.userInfo?[UIKeyboardAnimationDurationUserInfoKey] as? TimeInterval, + let frame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect, + let duration = notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? TimeInterval, let viewController = self.viewController else { return } @@ -62,7 +62,7 @@ final class ScrollViewKeyboardAdjuster { @objc func onKeyboardWillHide(notification: NSNotification) { guard keyboardIsShowing, - let duration = notification.userInfo?[UIKeyboardAnimationDurationUserInfoKey] as? TimeInterval + let duration = notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? TimeInterval else { return } keyboardIsShowing = false diff --git a/Classes/Systems/ShortcutHandler.swift b/Classes/Systems/ShortcutHandler.swift index 8d9c0112..fbcaf395 100644 --- a/Classes/Systems/ShortcutHandler.swift +++ b/Classes/Systems/ShortcutHandler.swift @@ -33,7 +33,7 @@ extension UIApplicationShortcutItem { localizedTitle: localizedTitle, localizedSubtitle: localizedSubtitle, icon: icon, - userInfo: route.encoded + userInfo: route.encoded as [String: NSSecureCoding] ) } diff --git a/Classes/Systems/UIContentSizeCategoryChangeHandler.swift b/Classes/Systems/UIContentSizeCategoryChangeHandler.swift index b4e1c58c..0ad7e27d 100644 --- a/Classes/Systems/UIContentSizeCategoryChangeHandler.swift +++ b/Classes/Systems/UIContentSizeCategoryChangeHandler.swift @@ -19,7 +19,7 @@ final class UIContentSizeCategoryChangeHandler { center.addObserver( self, selector: #selector(contentSizeCategoryDidChange), - name: .UIContentSizeCategoryDidChange, + name: UIContentSizeCategory.didChangeNotification, object: nil ) } diff --git a/Classes/Utility/Accessibility.swift b/Classes/Utility/Accessibility.swift index 18b94f2b..ec6732a4 100644 --- a/Classes/Utility/Accessibility.swift +++ b/Classes/Utility/Accessibility.swift @@ -40,5 +40,5 @@ private extension AccessibilityHelper { // MARK: Reduce motion var trueUnlessReduceMotionEnabled: Bool { - return !UIAccessibilityIsReduceMotionEnabled() + return !UIAccessibility.isReduceMotionEnabled } diff --git a/Classes/Utility/AlertAction.swift b/Classes/Utility/AlertAction.swift index c483b84a..1fec8923 100644 --- a/Classes/Utility/AlertAction.swift +++ b/Classes/Utility/AlertAction.swift @@ -18,7 +18,7 @@ struct AlertAction { let rootViewController: UIViewController? let title: String? - let style: UIAlertActionStyle + let style: UIAlertAction.Style enum AlertShareType { case shareUrl diff --git a/Classes/Utility/AlertActionBuilder.swift b/Classes/Utility/AlertActionBuilder.swift index 5bbf28c6..300322dc 100644 --- a/Classes/Utility/AlertActionBuilder.swift +++ b/Classes/Utility/AlertActionBuilder.swift @@ -18,7 +18,7 @@ class AlertActionBuilder { var rootViewController: UIViewController? var title: String? - var style: UIAlertActionStyle? + var style: UIAlertAction.Style? // MARK: Init diff --git a/Classes/Utility/HapticFeedback.swift b/Classes/Utility/HapticFeedback.swift index e3359a46..f25a69a5 100644 --- a/Classes/Utility/HapticFeedback.swift +++ b/Classes/Utility/HapticFeedback.swift @@ -13,7 +13,7 @@ enum Haptic { static private let selectionGenerator = UISelectionFeedbackGenerator() static private let notificationGenerator = UINotificationFeedbackGenerator() - static func triggerImpact(_ style: UIImpactFeedbackStyle) { + static func triggerImpact(_ style: UIImpactFeedbackGenerator.FeedbackStyle) { UIImpactFeedbackGenerator(style: style).impactOccurred() } @@ -21,7 +21,7 @@ enum Haptic { selectionGenerator.selectionChanged() } - static func triggerNotification(_ type: UINotificationFeedbackType) { + static func triggerNotification(_ type: UINotificationFeedbackGenerator.FeedbackType) { notificationGenerator.notificationOccurred(type) } } diff --git a/Classes/Utility/Image+Base64.swift b/Classes/Utility/Image+Base64.swift index bc667228..f58d4bd7 100644 --- a/Classes/Utility/Image+Base64.swift +++ b/Classes/Utility/Image+Base64.swift @@ -17,7 +17,7 @@ extension UIImage { /// Compression is a value between 0.0 and 1.0. Lower is smaller file size but worse quality. func compressAndEncode(compression: CGFloat = 0.65, completion: @escaping (Result) -> Void) { DispatchQueue.global(qos: .background).async { - let data = UIImageJPEGRepresentation(self, compression) + let data = self.jpegData(compressionQuality: compression) guard let base64 = data?.base64EncodedString() else { completion(.error(nil)) diff --git a/Classes/Utility/LogEnvironmentInformation.swift b/Classes/Utility/LogEnvironmentInformation.swift index a1196e6d..dfd3594b 100644 --- a/Classes/Utility/LogEnvironmentInformation.swift +++ b/Classes/Utility/LogEnvironmentInformation.swift @@ -13,7 +13,7 @@ func LogEnvironmentInformation(application: UIApplication) { // information to help understand the device+locale demographics of users // be able to better prioritize & serve AX, RTL, and non-en languages Answers.logCustomEvent(withName: "environment", customAttributes: [ - "voice-enabled": UIAccessibilityIsVoiceOverRunning() ? "1": "0", + "voice-enabled": UIAccessibility.isVoiceOverRunning ? "1": "0", "lang": NSLocale.autoupdatingCurrent.languageCode ?? "n/a", "country": NSLocale.autoupdatingCurrent.regionCode ?? "n/a", "rtl": application.userInterfaceLayoutDirection == .rightToLeft ? "1" : "0" diff --git a/Classes/Utility/RepositoryAttributedString.swift b/Classes/Utility/RepositoryAttributedString.swift index 6a24fef1..6d1411f9 100644 --- a/Classes/Utility/RepositoryAttributedString.swift +++ b/Classes/Utility/RepositoryAttributedString.swift @@ -9,12 +9,12 @@ import Foundation func RepositoryAttributedString(owner: String, name: String) -> NSAttributedString { - let ownerAttributes: [NSAttributedStringKey: Any] = [ + let ownerAttributes: [NSAttributedString.Key: Any] = [ .font: Styles.Text.body.preferredFont, .foregroundColor: Styles.Colors.Gray.dark.color ] - let nameAttributes: [NSAttributedStringKey: Any] = [ + let nameAttributes: [NSAttributedString.Key: Any] = [ .font: Styles.Text.bodyBold.preferredFont, .foregroundColor: Styles.Colors.Gray.dark.color ] diff --git a/Classes/Utility/UIViewController+Routing.swift b/Classes/Utility/UIViewController+Routing.swift index 7f50aed3..cd8ec207 100644 --- a/Classes/Utility/UIViewController+Routing.swift +++ b/Classes/Utility/UIViewController+Routing.swift @@ -16,7 +16,7 @@ extension UIViewController { case .url(let url): presentSafari(url: url) case .email(let email): if let url = URL(string: "mailTo:\(email)") { - UIApplication.shared.open(url, options: [:], completionHandler: nil) + UIApplication.shared.open(url) } case .username(let username): presentProfile(login: username) case .commit(let commit): presentCommit(owner: commit.owner, repo: commit.repo, hash: commit.hash) diff --git a/Classes/View Controllers/ContrastContextMenu.swift b/Classes/View Controllers/ContrastContextMenu.swift index 7ecef0a8..6ebe88ae 100644 --- a/Classes/View Controllers/ContrastContextMenu.swift +++ b/Classes/View Controllers/ContrastContextMenu.swift @@ -37,9 +37,9 @@ final class ContrastContextMenu: UITableViewController { private class Cell: UITableViewCell { static let reuseIdentifier = "cell" var border: UIView? - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) - accessibilityTraits |= UIAccessibilityTraitButton + accessibilityTraits.insert(.button) isAccessibilityElement = true selectedBackgroundView = UIView() diff --git a/Classes/View Controllers/UINavigationItem+TitleSubtitle.swift b/Classes/View Controllers/UINavigationItem+TitleSubtitle.swift index 3924f905..c34ca6cb 100644 --- a/Classes/View Controllers/UINavigationItem+TitleSubtitle.swift +++ b/Classes/View Controllers/UINavigationItem+TitleSubtitle.swift @@ -41,11 +41,11 @@ extension UINavigationItem { return } - let titleAttributes: [NSAttributedStringKey: Any] = [ + let titleAttributes: [NSAttributedString.Key: Any] = [ .font: Styles.Text.bodyBold.preferredFont, .foregroundColor: Styles.Colors.Gray.dark.color ] - let subtitleAttributes: [NSAttributedStringKey: Any] = [ + let subtitleAttributes: [NSAttributedString.Key: Any] = [ .font: Styles.Text.secondaryBold.preferredFont, .foregroundColor: Styles.Colors.Gray.light.color ] diff --git a/Classes/View Controllers/UIViewController+Alerts.swift b/Classes/View Controllers/UIViewController+Alerts.swift index bfdbd861..bfd903a4 100644 --- a/Classes/View Controllers/UIViewController+Alerts.swift +++ b/Classes/View Controllers/UIViewController+Alerts.swift @@ -21,7 +21,7 @@ extension UIViewController { extension UIAlertController { - static func configured(title: String? = nil, message: String? = nil, preferredStyle: UIAlertControllerStyle) -> UIAlertController { + static func configured(title: String? = nil, message: String? = nil, preferredStyle: UIAlertController.Style) -> UIAlertController { let alertController = UIAlertController(title: title, message: message, preferredStyle: preferredStyle) alertController.view.tintColor = Styles.Colors.Blue.medium.color return alertController diff --git a/Classes/View Controllers/UIViewController+LoadingIndicator.swift b/Classes/View Controllers/UIViewController+LoadingIndicator.swift index 70f32dca..45a16e75 100644 --- a/Classes/View Controllers/UIViewController+LoadingIndicator.swift +++ b/Classes/View Controllers/UIViewController+LoadingIndicator.swift @@ -11,13 +11,13 @@ import UIKit extension UIViewController { func setRightBarItemSpinning() { - let activity = UIActivityIndicatorView(activityIndicatorStyle: .gray) + let activity = UIActivityIndicatorView(style: .gray) activity.startAnimating() navigationItem.rightBarButtonItem = UIBarButtonItem(customView: activity) } func setLeftBarItemSpinning() { - let activity = UIActivityIndicatorView(activityIndicatorStyle: .gray) + let activity = UIActivityIndicatorView(style: .gray) activity.startAnimating() navigationItem.leftBarButtonItem = UIBarButtonItem(customView: activity) } diff --git a/Classes/Views/EmptyLoadingView.swift b/Classes/Views/EmptyLoadingView.swift index 670be3e6..9c29d9c3 100644 --- a/Classes/Views/EmptyLoadingView.swift +++ b/Classes/Views/EmptyLoadingView.swift @@ -10,7 +10,7 @@ import UIKit final class EmptyLoadingView: UIView { - private let activity = UIActivityIndicatorView(activityIndicatorStyle: .gray) + private let activity = UIActivityIndicatorView(style: .gray) override init(frame: CGRect) { super.init(frame: frame) diff --git a/Classes/Views/LabelCell.swift b/Classes/Views/LabelCell.swift index 9c6d47f3..411f0ac5 100644 --- a/Classes/Views/LabelCell.swift +++ b/Classes/Views/LabelCell.swift @@ -17,7 +17,7 @@ final class LabelCell: UICollectionViewCell { super.init(frame: frame) contentView.backgroundColor = .clear - accessibilityTraits |= UIAccessibilityTraitStaticText + accessibilityTraits.insert(.staticText) label.backgroundColor = .clear label.textAlignment = .center diff --git a/Classes/Views/LabelListCell.swift b/Classes/Views/LabelListCell.swift index 48c699e6..09d8835e 100644 --- a/Classes/Views/LabelListCell.swift +++ b/Classes/Views/LabelListCell.swift @@ -26,7 +26,7 @@ final class LabelListCell: UICollectionViewCell, ListBindable { super.init(frame: frame) isAccessibilityElement = true - accessibilityTraits |= UIAccessibilityTraitButton + accessibilityTraits.insert(.button) layer.cornerRadius = Styles.Sizes.labelCornerRadius contentView.layer.cornerRadius = Styles.Sizes.labelCornerRadius diff --git a/Classes/Views/MarkdownAttributeHandling.swift b/Classes/Views/MarkdownAttributeHandling.swift index ff5bc141..5d116007 100644 --- a/Classes/Views/MarkdownAttributeHandling.swift +++ b/Classes/Views/MarkdownAttributeHandling.swift @@ -18,7 +18,7 @@ enum DetectedMarkdownAttribute { case checkbox(MarkdownCheckboxModel) } -func DetectMarkdownAttribute(attributes: [NSAttributedStringKey: Any]?) -> DetectedMarkdownAttribute? { +func DetectMarkdownAttribute(attributes: [NSAttributedString.Key: Any]?) -> DetectedMarkdownAttribute? { guard let attributes = attributes else { return nil } if let urlString = attributes[MarkdownAttribute.url] as? String, let url = URL(string: urlString) { return .url(url) diff --git a/Classes/Views/MarkdownStyledTextView.swift b/Classes/Views/MarkdownStyledTextView.swift index 1f1659e5..19e176e8 100644 --- a/Classes/Views/MarkdownStyledTextView.swift +++ b/Classes/Views/MarkdownStyledTextView.swift @@ -37,7 +37,7 @@ class MarkdownStyledTextView: StyledTextView, StyledTextViewDelegate { // MARK: StyledTextViewDelegate - func didTap(view: StyledTextView, attributes: [NSAttributedStringKey: Any], point: CGPoint) { + func didTap(view: StyledTextView, attributes: [NSAttributedString.Key: Any], point: CGPoint) { if let details = attributes[MarkdownAttribute.details] as? String { showDetailsInMenu(details: details, point: point) } @@ -45,7 +45,7 @@ class MarkdownStyledTextView: StyledTextView, StyledTextViewDelegate { tapDelegate?.didTap(cell: self, attribute: detected) } - func didLongPress(view: StyledTextView, attributes: [NSAttributedStringKey: Any], point: CGPoint) { + func didLongPress(view: StyledTextView, attributes: [NSAttributedString.Key: Any], point: CGPoint) { if let urlString = attributes[MarkdownAttribute.url] as? String, let url = URL(string: urlString) { show(url: url) } diff --git a/Classes/Views/SelectableCell.swift b/Classes/Views/SelectableCell.swift index 49096e4d..f0d9c2c9 100644 --- a/Classes/Views/SelectableCell.swift +++ b/Classes/Views/SelectableCell.swift @@ -48,7 +48,7 @@ class SelectableCell: UICollectionViewCell { override init(frame: CGRect) { super.init(frame: frame) - accessibilityTraits |= UIAccessibilityTraitButton + accessibilityTraits.insert(.button) isAccessibilityElement = true } @@ -92,7 +92,7 @@ class SwipeSelectableCell: SwipeCollectionViewCell { override init(frame: CGRect) { super.init(frame: frame) - accessibilityTraits |= UIAccessibilityTraitButton + accessibilityTraits.insert(.button) isAccessibilityElement = true } diff --git a/Classes/Views/SpinnerCell.swift b/Classes/Views/SpinnerCell.swift index f2ef23c2..cd2a6e82 100644 --- a/Classes/Views/SpinnerCell.swift +++ b/Classes/Views/SpinnerCell.swift @@ -11,7 +11,7 @@ import SnapKit final class SpinnerCell: UICollectionViewCell { - let activity = UIActivityIndicatorView(activityIndicatorStyle: .gray) + let activity = UIActivityIndicatorView(style: .gray) override init(frame: CGRect) { super.init(frame: frame) diff --git a/Classes/Views/StyledTableCell.swift b/Classes/Views/StyledTableCell.swift index 84b735e6..e0228eb0 100644 --- a/Classes/Views/StyledTableCell.swift +++ b/Classes/Views/StyledTableCell.swift @@ -15,7 +15,7 @@ class StyledTableCell: UITableViewCell { configure() } - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) configure() } diff --git a/Classes/Views/Styles.swift b/Classes/Views/Styles.swift index ecf1938d..291fd008 100644 --- a/Classes/Views/Styles.swift +++ b/Classes/Views/Styles.swift @@ -127,7 +127,7 @@ enum Styles { static func setupAppearance() { UINavigationBar.appearance().tintColor = Styles.Colors.Blue.medium.color UINavigationBar.appearance().titleTextAttributes = - [NSAttributedStringKey.foregroundColor: Styles.Colors.Gray.dark.color] + [.foregroundColor: Styles.Colors.Gray.dark.color] UISwitch.appearance().onTintColor = Styles.Colors.Blue.medium.color UISearchBar.appearance().tintColor = Styles.Colors.Blue.medium.color DropdownTitleView.appearance().chevronTintColor = Styles.Colors.Gray.medium.color @@ -146,7 +146,7 @@ extension TextStyle { return self.font(contentSizeCategory: UIContentSizeCategory.preferred) } - func with(attributes: [NSAttributedStringKey: Any]) -> TextStyle { + func with(attributes: [NSAttributedString.Key: Any]) -> TextStyle { var newAttributes = self.attributes for (key, value) in attributes { newAttributes[key] = value diff --git a/Classes/Views/TextActionsController.swift b/Classes/Views/TextActionsController.swift index 9606c5cb..f0cc4035 100644 --- a/Classes/Views/TextActionsController.swift +++ b/Classes/Views/TextActionsController.swift @@ -57,8 +57,8 @@ final class TextActionsController: NSObject, // MARK: UIImagePickerControllerDelegate - func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String: Any]) { - guard let image = info[UIImagePickerControllerOriginalImage] as? UIImage else { return } + func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) { + guard let image = info[.originalImage] as? UIImage else { return } let username = client?.userSession?.username ?? Constants.Strings.unknown guard let uploadController = ImageUploadTableViewController.create(image, username: username, delegate: self) else { return } diff --git a/Classes/Views/UIButton+Label.swift b/Classes/Views/UIButton+Label.swift index a8b594fd..811f181a 100644 --- a/Classes/Views/UIButton+Label.swift +++ b/Classes/Views/UIButton+Label.swift @@ -19,7 +19,7 @@ extension UIButton { } func setupAsLabel(icon: Bool = true) { - accessibilityTraits = UIAccessibilityTraitNone + accessibilityTraits = .none tintColor = .white titleLabel?.font = Styles.Text.smallTitle.preferredFont layer.cornerRadius = Styles.Sizes.labelCornerRadius diff --git a/Classes/Views/UISearchBar+Keyboard.swift b/Classes/Views/UISearchBar+Keyboard.swift new file mode 100644 index 00000000..78314560 --- /dev/null +++ b/Classes/Views/UISearchBar+Keyboard.swift @@ -0,0 +1,24 @@ +// +// UISearchBar+Keyboard.swift +// Freetime +// +// Created by Ryan Nystrom on 11/7/17. +// Copyright © 2017 Ryan Nystrom. All rights reserved. +// + +import UIKit + +extension UISearchBar { + + // MARK: Public API + + func resignWhenKeyboardHides() { + NotificationCenter.default.addObserver( + self, + selector: #selector(resignFirstResponder), + name: UIResponder.keyboardWillHideNotification, + object: nil + ) + } + +} diff --git a/Freetime.xcodeproj/project.pbxproj b/Freetime.xcodeproj/project.pbxproj index 1f6f303d..3324fa4f 100644 --- a/Freetime.xcodeproj/project.pbxproj +++ b/Freetime.xcodeproj/project.pbxproj @@ -2501,6 +2501,7 @@ 294EE4C4209006C2002C9CB1 = { CreatedOnToolsVersion = 9.3; DevelopmentTeam = 523C4DWBTH; + LastSwiftMigration = 1010; ProvisioningStyle = Automatic; SystemCapabilities = { com.apple.ApplicationGroups.iOS = { @@ -2511,7 +2512,7 @@ 297AE8331EC0D58A00B44A1F = { CreatedOnToolsVersion = 8.3.2; DevelopmentTeam = 523C4DWBTH; - LastSwiftMigration = 0900; + LastSwiftMigration = 1010; ProvisioningStyle = Automatic; SystemCapabilities = { com.apple.ApplicationGroups.iOS = { @@ -2528,7 +2529,7 @@ 297AE8471EC0D58A00B44A1F = { CreatedOnToolsVersion = 8.3.2; DevelopmentTeam = 523C4DWBTH; - LastSwiftMigration = 0900; + LastSwiftMigration = 1010; ProvisioningStyle = Automatic; TestTargetID = 297AE8331EC0D58A00B44A1F; }; @@ -3591,7 +3592,7 @@ PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = 4; WATCHOS_DEPLOYMENT_TARGET = 4.3; }; @@ -3615,7 +3616,7 @@ PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = 4; WATCHOS_DEPLOYMENT_TARGET = 4.3; }; @@ -3639,7 +3640,7 @@ PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = 4; WATCHOS_DEPLOYMENT_TARGET = 4.3; }; @@ -3801,7 +3802,7 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "Resources/Freetime-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -3844,7 +3845,7 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "Resources/Freetime-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -3859,7 +3860,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.whoisryannystrom.FreetimeTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Freetime.app/Freetime"; }; name = Debug; @@ -3875,7 +3876,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.whoisryannystrom.FreetimeTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Freetime.app/Freetime"; }; name = Release; @@ -3981,7 +3982,7 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = TESTFLIGHT; SWIFT_OBJC_BRIDGING_HEADER = "Resources/Freetime-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = TestFlight; }; @@ -3996,7 +3997,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.whoisryannystrom.FreetimeTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Freetime.app/Freetime"; }; name = TestFlight; diff --git a/FreetimeTests/InboxZeroLoaderTests.swift b/FreetimeTests/InboxZeroLoaderTests.swift index e2da42f5..adc9e775 100644 --- a/FreetimeTests/InboxZeroLoaderTests.swift +++ b/FreetimeTests/InboxZeroLoaderTests.swift @@ -10,7 +10,7 @@ import XCTest @testable import Freetime extension Date { - static func date(from: [Calendar.Component : Int]) -> Date { + static func date(from: [Calendar.Component: Int]) -> Date { var dc = DateComponents() dc.calendar = Calendar.current for (comp, val) in from { diff --git a/FreetimeTests/Search Tests/SearchRecentViewModelTests.swift b/FreetimeTests/Search Tests/SearchRecentViewModelTests.swift index b3c87aff..c66a5756 100644 --- a/FreetimeTests/Search Tests/SearchRecentViewModelTests.swift +++ b/FreetimeTests/Search Tests/SearchRecentViewModelTests.swift @@ -70,14 +70,14 @@ class SearchRecentViewModelTests: XCTestCase { XCTAssertEqual(expected, actual) } - private var standardAttributes: [NSAttributedStringKey: Any] { + private var standardAttributes: [NSAttributedString.Key: Any] { return [ .font: Styles.Text.body.preferredFont, .foregroundColor: Styles.Colors.Gray.dark.color ] } - private var boldAttributes: [NSAttributedStringKey: Any] { + private var boldAttributes: [NSAttributedString.Key: Any] { return [ .font: Styles.Text.bodyBold.preferredFont, .foregroundColor: Styles.Colors.Gray.dark.color diff --git a/FreetimeWatch Extension/ReadAllRowController.swift b/FreetimeWatch Extension/ReadAllRowController.swift index d7860468..53e37813 100644 --- a/FreetimeWatch Extension/ReadAllRowController.swift +++ b/FreetimeWatch Extension/ReadAllRowController.swift @@ -20,7 +20,7 @@ final class ReadAllRowController: NSObject { readAllLabel.setIsAccessibilityElement(false) group.setIsAccessibilityElement(true) group.setAccessibilityLabel(readAll) - group.setAccessibilityTraits(UIAccessibilityTraitButton) + group.setAccessibilityTraits(.button) } } diff --git a/FreetimeWatch Extension/RepoInboxRowController.swift b/FreetimeWatch Extension/RepoInboxRowController.swift index 45db3500..b3783157 100644 --- a/FreetimeWatch Extension/RepoInboxRowController.swift +++ b/FreetimeWatch Extension/RepoInboxRowController.swift @@ -66,7 +66,7 @@ final class RepoInboxRowController: NSObject { } [typeImage, titleLabel, dateLabel, numberLabel].forEach { $0.setIsAccessibilityElement(false) } - enclosingGroup.setAccessibilityTraits(UIAccessibilityTraitStaticText) + enclosingGroup.setAccessibilityTraits(.staticText) enclosingGroup.setIsAccessibilityElement(true) enclosingGroup.setAccessibilityLabel(accessibilityLabel) // FIXME: We should add the notification type here, probably by using "NotificationType" (only available in GitHawk) or remove that completely and add the localization to V3NotificationType }