From 9af288d9f0f6ac40b37b2f83c87717a6e9592c2f Mon Sep 17 00:00:00 2001 From: YoungJun Lee Date: Mon, 22 Jun 2020 13:30:09 +0900 Subject: [PATCH] Supported the version 5.2.4 of swift on Xcode 11.5 --- Composer/Classes/Addons/Editing/EditingView.swift | 2 +- Composer/Classes/Addons/Hints/HintsView.swift | 4 ++-- Composer/Classes/Addons/Reply/ReplyView.swift | 2 +- Composer/Classes/Library/AudioRecorder.swift | 4 ++-- Composer/Classes/Overlays/PreviewAudioView.swift | 4 ++-- Composer/Classes/Overlays/RecordAudioView.swift | 4 ++-- Composer/Classes/Views/ComposerTextView.swift | 4 ++-- .../Classes/RocketChatViewController.swift | 12 ++++++------ 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Composer/Classes/Addons/Editing/EditingView.swift b/Composer/Classes/Addons/Editing/EditingView.swift index b55f81e..55f3a6b 100644 --- a/Composer/Classes/Addons/Editing/EditingView.swift +++ b/Composer/Classes/Addons/Editing/EditingView.swift @@ -83,7 +83,7 @@ public class EditingView: UIView, ComposerLocalizable { clipsToBounds = true isHidden = true - NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in + NotificationCenter.default.addObserver(forName: NSNotification.Name.UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in self?.setNeedsLayout() }) diff --git a/Composer/Classes/Addons/Hints/HintsView.swift b/Composer/Classes/Addons/Hints/HintsView.swift index 298db67..c8503e9 100644 --- a/Composer/Classes/Addons/Hints/HintsView.swift +++ b/Composer/Classes/Addons/Hints/HintsView.swift @@ -101,14 +101,14 @@ public class HintsView: UITableView { Shared initialization procedures. */ private func commonInit() { - NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in + NotificationCenter.default.addObserver(forName: NSNotification.Name.UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in self?.beginUpdates() self?.endUpdates() }) dataSource = self delegate = self - rowHeight = UITableView.automaticDimension + rowHeight = UITableViewAutomaticDimension estimatedRowHeight = 44 separatorInset = UIEdgeInsets( top: 0, diff --git a/Composer/Classes/Addons/Reply/ReplyView.swift b/Composer/Classes/Addons/Reply/ReplyView.swift index d6a83d2..0743f8b 100644 --- a/Composer/Classes/Addons/Reply/ReplyView.swift +++ b/Composer/Classes/Addons/Reply/ReplyView.swift @@ -133,7 +133,7 @@ public class ReplyView: UIView { clipsToBounds = true isHidden = true - NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in + NotificationCenter.default.addObserver(forName: NSNotification.Name.UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in self?.setNeedsLayout() }) diff --git a/Composer/Classes/Library/AudioRecorder.swift b/Composer/Classes/Library/AudioRecorder.swift index a82a78f..99196e7 100644 --- a/Composer/Classes/Library/AudioRecorder.swift +++ b/Composer/Classes/Library/AudioRecorder.swift @@ -41,7 +41,7 @@ public class AudioRecorder: NSObject { let session = AVAudioSession.sharedInstance() do { - try session.setCategory(AVAudioSession.Category(rawValue: AVAudioSession.Category.playAndRecord.rawValue)) + try session.setCategory(AVAudioSession.Category(string: AVAudioSessionCategoryPlayAndRecord) as String) setUpRecorder() } catch let error { print("Set category error: \(error.localizedDescription).") @@ -80,7 +80,7 @@ public class AudioRecorder: NSObject { private func setSession(active: Bool) { let session = AVAudioSession.sharedInstance() do { - try session.setActive(active, options: [.notifyOthersOnDeactivation]) + try session.setActive(active, with: [.notifyOthersOnDeactivation]) } catch let error { print("Set active error: \(error.localizedDescription).") } diff --git a/Composer/Classes/Overlays/PreviewAudioView.swift b/Composer/Classes/Overlays/PreviewAudioView.swift index 684fb0d..8e01c66 100644 --- a/Composer/Classes/Overlays/PreviewAudioView.swift +++ b/Composer/Classes/Overlays/PreviewAudioView.swift @@ -108,7 +108,7 @@ public class PreviewAudioView: UIView, ComposerLocalizable { backgroundColor = .white clipsToBounds = true - NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in + NotificationCenter.default.addObserver(forName: NSNotification.Name.UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in self?.setNeedsLayout() }) @@ -284,7 +284,7 @@ public class AudioView: UIView { layer.cornerRadius = Consts.layerCornerRadius clipsToBounds = true - NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in + NotificationCenter.default.addObserver(forName: NSNotification.Name.UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in self?.setNeedsLayout() }) diff --git a/Composer/Classes/Overlays/RecordAudioView.swift b/Composer/Classes/Overlays/RecordAudioView.swift index 66f30c1..b7fafe5 100644 --- a/Composer/Classes/Overlays/RecordAudioView.swift +++ b/Composer/Classes/Overlays/RecordAudioView.swift @@ -121,7 +121,7 @@ public class RecordAudioView: UIView { repeats: true ) - NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in + NotificationCenter.default.addObserver(forName: NSNotification.Name.UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in self?.setNeedsLayout() }) @@ -317,7 +317,7 @@ public class SwipeIndicatorView: UIView, ComposerLocalizable { private func commonInit() { clipsToBounds = true - NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in + NotificationCenter.default.addObserver(forName: NSNotification.Name.UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in self?.setNeedsLayout() }) diff --git a/Composer/Classes/Views/ComposerTextView.swift b/Composer/Classes/Views/ComposerTextView.swift index d37c675..78cf193 100644 --- a/Composer/Classes/Views/ComposerTextView.swift +++ b/Composer/Classes/Views/ComposerTextView.swift @@ -79,7 +79,7 @@ public class ComposerTextView: UITextView { private func commonInit() { let notificationCenter = NotificationCenter.default - notificationCenter.addObserver(self, selector: #selector(textDidChange), name: UITextView.textDidChangeNotification, object: nil) + notificationCenter.addObserver(self, selector: #selector(textDidChange), name: NSNotification.Name.UITextViewTextDidChange, object: nil) placeholderLabel.addObserver(self, forKeyPath: "bounds", options: .new, context: nil) self.addObserver(self, forKeyPath: "contentSize", options: .new, context: nil) @@ -130,7 +130,7 @@ public class ComposerTextView: UITextView { } deinit { - NotificationCenter.default.removeObserver(self, name: UITextView.textDidChangeNotification, object: nil) + NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UITextViewTextDidChange, object: nil) } } diff --git a/RocketChatViewController/Classes/RocketChatViewController.swift b/RocketChatViewController/Classes/RocketChatViewController.swift index 872b627..6dd0a53 100644 --- a/RocketChatViewController/Classes/RocketChatViewController.swift +++ b/RocketChatViewController/Classes/RocketChatViewController.swift @@ -288,7 +288,7 @@ open class RocketChatViewController: UICollectionViewController { collectionView.scrollsToTop = false if let flowLayout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout, isSelfSizing { - flowLayout.estimatedItemSize = UICollectionViewFlowLayout.automaticSize + flowLayout.estimatedItemSize = UICollectionViewFlowLayoutAutomaticSize } } @@ -418,7 +418,7 @@ extension RocketChatViewController { NotificationCenter.default.addObserver( self, selector: #selector(_onKeyboardFrameWillChangeNotificationReceived(_:)), - name: UIResponder.keyboardWillChangeFrameNotification, + name: NSNotification.Name.UIKeyboardWillChangeFrame, object: nil ) } @@ -426,7 +426,7 @@ extension RocketChatViewController { func stopObservingKeyboard() { NotificationCenter.default.removeObserver( self, - name: UIResponder.keyboardWillChangeFrameNotification, + name: NSNotification.Name.UIKeyboardWillChangeFrame, object: nil ) } @@ -438,7 +438,7 @@ extension RocketChatViewController { guard let userInfo = notification.userInfo, - let keyboardFrame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue, + let keyboardFrame = (userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue, let collectionView = collectionView else { return @@ -448,8 +448,8 @@ extension RocketChatViewController { let safeAreaFrame = view.safeAreaLayoutGuide.layoutFrame.insetBy(dx: 0, dy: -additionalSafeAreaInsets.top) let intersection = safeAreaFrame.intersection(keyboardFrameInView) - let animationDuration: TimeInterval = (notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue ?? 0 - let animationCurveRawNSN = notification.userInfo?[UIResponder.keyboardAnimationCurveUserInfoKey] as? NSNumber + let animationDuration: TimeInterval = (notification.userInfo?[UIKeyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue ?? 0 + let animationCurveRawNSN = notification.userInfo?[UIKeyboardAnimationCurveUserInfoKey] as? NSNumber let animationCurveRaw = animationCurveRawNSN?.uintValue ?? UIView.AnimationOptions.curveEaseInOut.rawValue let animationCurve = UIView.AnimationOptions(rawValue: animationCurveRaw)