From 7be8f308777088ba959f032421563ab763a57e35 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 27 Aug 2018 10:21:03 -0400 Subject: [PATCH] Apply -> Never. --- ...ShareToExistingContactViewController.swift | 4 +-- .../ViewControllers/CallViewController.swift | 2 +- .../ColorPickerViewController.swift | 4 +-- .../ContactViewController.swift | 2 +- .../src/ViewControllers/ContactsPicker.swift | 2 +- .../ConversationHeaderView.swift | 4 +-- .../CropScaleImageViewController.swift | 2 +- .../DebugUI/DebugUIFileBrowser.swift | 2 +- ...ExperienceUpgradesPageViewController.swift | 4 +-- .../GifPicker/GifPickerLayout.swift | 2 +- .../GifPicker/GifPickerViewController.swift | 2 +- .../ConversationSearchViewController.swift | 2 +- .../HomeView/MessageStatusView.swift | 2 +- .../LongTextViewController.swift | 2 +- .../MediaGalleryViewController.swift | 2 +- .../MediaPageViewController.swift | 2 +- .../MediaTileViewController.swift | 8 +++--- .../MenuActionsViewController.swift | 6 ++--- .../MessageDetailViewController.swift | 2 +- Signal/src/views/AttachmentPointerView.swift | 2 +- Signal/src/views/AudioProgressView.swift | 2 +- Signal/src/views/ContactCell.swift | 2 +- Signal/src/views/DismissableTextField.swift | 4 +-- Signal/src/views/GroupTableViewCell.swift | 2 +- Signal/src/views/QuotedReplyPreview.swift | 2 +- Signal/src/views/ReminderView.swift | 4 +-- Signal/src/views/Toast.swift | 4 +-- .../AttachmentApprovalViewController.swift | 4 +-- .../ViewControllers/ContactFieldView.swift | 2 +- .../ContactShareApprovalViewController.swift | 4 +-- .../EditContactShareNameViewController.swift | 4 +-- .../ViewControllers/MediaMessageView.swift | 2 +- .../MessageApprovalViewController.swift | 2 +- ...ModalActivityIndicatorViewController.swift | 2 +- SignalMessaging/Views/AvatarImageView.swift | 2 +- .../DisappearingTimerConfigurationView.swift | 2 +- SignalMessaging/Views/GradientView.swift | 2 +- SignalMessaging/Views/OWSFlatButton.swift | 2 +- SignalMessaging/Views/OWSNavigationBar.swift | 2 +- SignalMessaging/Views/TappableStackView.swift | 2 +- SignalMessaging/Views/TappableView.swift | 2 +- SignalMessaging/Views/VideoPlayerView.swift | 4 +-- SignalServiceKit/src/Util/OWSSwiftUtils.swift | 26 ++++++++++++------- .../SAEFailedViewController.swift | 2 +- .../SAELoadViewController.swift | 2 +- 45 files changed, 76 insertions(+), 70 deletions(-) diff --git a/Signal/src/ViewControllers/AddContactShareToExistingContactViewController.swift b/Signal/src/ViewControllers/AddContactShareToExistingContactViewController.swift index b74d969b0..87f63fc66 100644 --- a/Signal/src/ViewControllers/AddContactShareToExistingContactViewController.swift +++ b/Signal/src/ViewControllers/AddContactShareToExistingContactViewController.swift @@ -25,11 +25,11 @@ class AddContactShareToExistingContactViewController: ContactsPicker, ContactsPi } required public init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } @objc required public init(allowsMultipleSelection: Bool, subtitleCellType: SubtitleCellValue) { - fatalError("init(allowsMultipleSelection:subtitleCellType:) has not been implemented") + notImplemented() } // MARK: - ContactsPickerDelegate diff --git a/Signal/src/ViewControllers/CallViewController.swift b/Signal/src/ViewControllers/CallViewController.swift index 82e6f765f..496fbcb09 100644 --- a/Signal/src/ViewControllers/CallViewController.swift +++ b/Signal/src/ViewControllers/CallViewController.swift @@ -136,7 +136,7 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver, @available(*, unavailable, message: "use init(call:) constructor instead.") required init?(coder aDecoder: NSCoder) { - fatalError("Unimplemented") + notImplemented() } required init(call: SignalCall) { diff --git a/Signal/src/ViewControllers/ColorPickerViewController.swift b/Signal/src/ViewControllers/ColorPickerViewController.swift index abee38003..ff35df906 100644 --- a/Signal/src/ViewControllers/ColorPickerViewController.swift +++ b/Signal/src/ViewControllers/ColorPickerViewController.swift @@ -31,7 +31,7 @@ class ColorView: UIView { } required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } } @@ -66,7 +66,7 @@ class ColorPickerViewController: UIViewController, UIPickerViewDelegate, UIPicke } required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } override func loadView() { diff --git a/Signal/src/ViewControllers/ContactViewController.swift b/Signal/src/ViewControllers/ContactViewController.swift index 243b03314..0521dbded 100644 --- a/Signal/src/ViewControllers/ContactViewController.swift +++ b/Signal/src/ViewControllers/ContactViewController.swift @@ -45,7 +45,7 @@ class ContactViewController: OWSViewController, ContactShareViewHelperDelegate { @available(*, unavailable, message: "use init(call:) constructor instead.") required init?(coder aDecoder: NSCoder) { - fatalError("Unimplemented") + notImplemented() } @objc diff --git a/Signal/src/ViewControllers/ContactsPicker.swift b/Signal/src/ViewControllers/ContactsPicker.swift index d6044f0b1..df46cf25f 100644 --- a/Signal/src/ViewControllers/ContactsPicker.swift +++ b/Signal/src/ViewControllers/ContactsPicker.swift @@ -87,7 +87,7 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView } required public init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } // MARK: - Lifecycle Methods diff --git a/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift b/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift index 8ffc6a458..13826c4c5 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift @@ -103,11 +103,11 @@ public class ConversationHeaderView: UIStackView { } required public init(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } required public override init(frame: CGRect) { - fatalError("init(frame:) has not been implemented") + notImplemented() } public override var intrinsicContentSize: CGSize { diff --git a/Signal/src/ViewControllers/CropScaleImageViewController.swift b/Signal/src/ViewControllers/CropScaleImageViewController.swift index b904dc7fa..5a05b0978 100644 --- a/Signal/src/ViewControllers/CropScaleImageViewController.swift +++ b/Signal/src/ViewControllers/CropScaleImageViewController.swift @@ -75,7 +75,7 @@ import SignalMessaging @available(*, unavailable, message:"use other constructor instead.") required init?(coder aDecoder: NSCoder) { - fatalError("\(#function) is unimplemented.") + notImplemented() } @objc required init(srcImage: UIImage, successCompletion : @escaping (UIImage) -> Void) { diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIFileBrowser.swift b/Signal/src/ViewControllers/DebugUI/DebugUIFileBrowser.swift index 005da5b70..167624163 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIFileBrowser.swift +++ b/Signal/src/ViewControllers/DebugUI/DebugUIFileBrowser.swift @@ -21,7 +21,7 @@ } required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } override func viewDidLoad() { diff --git a/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift b/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift index d7b093be0..6190d28bb 100644 --- a/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift +++ b/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift @@ -418,7 +418,7 @@ private class ExperienceUpgradeViewController: OWSViewController { } required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } override func loadView() { @@ -508,7 +508,7 @@ public class ExperienceUpgradesPageViewController: OWSViewController, UIPageView @available(*, unavailable, message:"unavailable, use initWithExperienceUpgrade instead") @objc public required init?(coder aDecoder: NSCoder) { - fatalError("unimplemented") + notImplemented() } // MARK: - View lifecycle diff --git a/Signal/src/ViewControllers/GifPicker/GifPickerLayout.swift b/Signal/src/ViewControllers/GifPicker/GifPickerLayout.swift index ea4b6bd21..2743a073e 100644 --- a/Signal/src/ViewControllers/GifPicker/GifPickerLayout.swift +++ b/Signal/src/ViewControllers/GifPicker/GifPickerLayout.swift @@ -21,7 +21,7 @@ class GifPickerLayout: UICollectionViewLayout { @available(*, unavailable, message:"use other constructor instead.") required init?(coder aDecoder: NSCoder) { - fatalError("\(#function) is unimplemented.") + notImplemented() } override init() { diff --git a/Signal/src/ViewControllers/GifPicker/GifPickerViewController.swift b/Signal/src/ViewControllers/GifPicker/GifPickerViewController.swift index 9231b8764..89d4e2cd7 100644 --- a/Signal/src/ViewControllers/GifPicker/GifPickerViewController.swift +++ b/Signal/src/ViewControllers/GifPicker/GifPickerViewController.swift @@ -55,7 +55,7 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect @available(*, unavailable, message:"use other constructor instead.") required init?(coder aDecoder: NSCoder) { - fatalError("\(#function) is unimplemented.") + notImplemented() } @objc diff --git a/Signal/src/ViewControllers/HomeView/ConversationSearchViewController.swift b/Signal/src/ViewControllers/HomeView/ConversationSearchViewController.swift index c39758a24..f2b7afa68 100644 --- a/Signal/src/ViewControllers/HomeView/ConversationSearchViewController.swift +++ b/Signal/src/ViewControllers/HomeView/ConversationSearchViewController.swift @@ -431,7 +431,7 @@ class EmptySearchResultCell: UITableViewCell { } required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } public func configure(searchText: String) { diff --git a/Signal/src/ViewControllers/HomeView/MessageStatusView.swift b/Signal/src/ViewControllers/HomeView/MessageStatusView.swift index 89a951e1a..cfe750d7f 100644 --- a/Signal/src/ViewControllers/HomeView/MessageStatusView.swift +++ b/Signal/src/ViewControllers/HomeView/MessageStatusView.swift @@ -47,6 +47,6 @@ public class MessageStatusView: UIView { } required public init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } } diff --git a/Signal/src/ViewControllers/LongTextViewController.swift b/Signal/src/ViewControllers/LongTextViewController.swift index 4a3940e1c..25f6cc6e8 100644 --- a/Signal/src/ViewControllers/LongTextViewController.swift +++ b/Signal/src/ViewControllers/LongTextViewController.swift @@ -21,7 +21,7 @@ public class LongTextViewController: OWSViewController { @available(*, unavailable, message:"use other constructor instead.") public required init?(coder aDecoder: NSCoder) { - fatalError("\(#function) is unimplemented.") + notImplemented() } @objc diff --git a/Signal/src/ViewControllers/MediaGalleryViewController.swift b/Signal/src/ViewControllers/MediaGalleryViewController.swift index 3126388f3..de19cef01 100644 --- a/Signal/src/ViewControllers/MediaGalleryViewController.swift +++ b/Signal/src/ViewControllers/MediaGalleryViewController.swift @@ -217,7 +217,7 @@ class MediaGalleryViewController: OWSNavigationController, MediaGalleryDataSourc } required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } // HACK: Though we don't have an input accessory view, the VC we are presented above (ConversationVC) does. diff --git a/Signal/src/ViewControllers/MediaPageViewController.swift b/Signal/src/ViewControllers/MediaPageViewController.swift index 9a10773e9..c4ce60630 100644 --- a/Signal/src/ViewControllers/MediaPageViewController.swift +++ b/Signal/src/ViewControllers/MediaPageViewController.swift @@ -116,7 +116,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou @available(*, unavailable, message: "Unimplemented") required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } deinit { diff --git a/Signal/src/ViewControllers/MediaTileViewController.swift b/Signal/src/ViewControllers/MediaTileViewController.swift index 79f6388f0..33b91cd48 100644 --- a/Signal/src/ViewControllers/MediaTileViewController.swift +++ b/Signal/src/ViewControllers/MediaTileViewController.swift @@ -65,7 +65,7 @@ public class MediaTileViewController: UICollectionViewController, MediaGalleryDa } required public init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } // MARK: View Lifecycle Overrides @@ -791,7 +791,7 @@ private class MediaGallerySectionHeader: UICollectionReusableView { @available(*, unavailable, message: "Unimplemented") required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } public func configure(title: String) { @@ -824,7 +824,7 @@ private class MediaGalleryStaticHeader: UICollectionViewCell { @available(*, unavailable, message: "Unimplemented") required public init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } public func configure(title: String) { @@ -917,7 +917,7 @@ private class MediaGalleryCell: UICollectionViewCell { @available(*, unavailable, message: "Unimplemented") required public init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } public func configure(item: MediaGalleryItem) { diff --git a/Signal/src/ViewControllers/MenuActionsViewController.swift b/Signal/src/ViewControllers/MenuActionsViewController.swift index e320cdd86..459a23277 100644 --- a/Signal/src/ViewControllers/MenuActionsViewController.swift +++ b/Signal/src/ViewControllers/MenuActionsViewController.swift @@ -52,7 +52,7 @@ class MenuActionsViewController: UIViewController, MenuActionSheetDelegate { } required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } // MARK: View LifeCycle @@ -304,7 +304,7 @@ class MenuActionSheetView: UIView, MenuActionViewDelegate { } required init?(coder aDecoder: NSCoder) { - fatalError("not implemented") + notImplemented() } @objc @@ -486,6 +486,6 @@ class MenuActionView: UIButton { } required init?(coder aDecoder: NSCoder) { - fatalError("not implemented") + notImplemented() } } diff --git a/Signal/src/ViewControllers/MessageDetailViewController.swift b/Signal/src/ViewControllers/MessageDetailViewController.swift index afe4160a0..e78c49df2 100644 --- a/Signal/src/ViewControllers/MessageDetailViewController.swift +++ b/Signal/src/ViewControllers/MessageDetailViewController.swift @@ -47,7 +47,7 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele @available(*, unavailable, message:"use other constructor instead.") required init?(coder aDecoder: NSCoder) { - fatalError("\(#function) is unimplemented.") + notImplemented() } @objc diff --git a/Signal/src/views/AttachmentPointerView.swift b/Signal/src/views/AttachmentPointerView.swift index b47150911..ce4d23438 100644 --- a/Signal/src/views/AttachmentPointerView.swift +++ b/Signal/src/views/AttachmentPointerView.swift @@ -75,7 +75,7 @@ class AttachmentPointerView: UIStackView { @available(*, unavailable, message: "use init(call:) constructor instead.") required init(coder aDecoder: NSCoder) { - fatalError("Unimplemented") + notImplemented() } private static var vSpacing: CGFloat = 5 diff --git a/Signal/src/views/AudioProgressView.swift b/Signal/src/views/AudioProgressView.swift index e4411b2c2..7741f6da1 100644 --- a/Signal/src/views/AudioProgressView.swift +++ b/Signal/src/views/AudioProgressView.swift @@ -48,7 +48,7 @@ import SignalServiceKit @available(*, unavailable, message:"use other constructor instead.") @objc public required init?(coder aDecoder: NSCoder) { - fatalError("\(#function) is unimplemented.") + notImplemented() } public required init() { diff --git a/Signal/src/views/ContactCell.swift b/Signal/src/views/ContactCell.swift index b2956dc55..a977a7c84 100644 --- a/Signal/src/views/ContactCell.swift +++ b/Signal/src/views/ContactCell.swift @@ -50,7 +50,7 @@ class ContactCell: UITableViewCell { } required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } override func prepareForReuse() { diff --git a/Signal/src/views/DismissableTextField.swift b/Signal/src/views/DismissableTextField.swift index fd5c391ae..b01ca40cb 100644 --- a/Signal/src/views/DismissableTextField.swift +++ b/Signal/src/views/DismissableTextField.swift @@ -30,7 +30,7 @@ class DismissInputBar: UIToolbar { } required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } @objc @@ -55,7 +55,7 @@ public class DismissableTextField: UITextField, DismissInputBarDelegate { } required public init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } // MARK: DismissInputBarDelegate diff --git a/Signal/src/views/GroupTableViewCell.swift b/Signal/src/views/GroupTableViewCell.swift index 543275f03..656a1d5aa 100644 --- a/Signal/src/views/GroupTableViewCell.swift +++ b/Signal/src/views/GroupTableViewCell.swift @@ -39,7 +39,7 @@ import SignalServiceKit } required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } @objc diff --git a/Signal/src/views/QuotedReplyPreview.swift b/Signal/src/views/QuotedReplyPreview.swift index 167e720a6..3464a8c88 100644 --- a/Signal/src/views/QuotedReplyPreview.swift +++ b/Signal/src/views/QuotedReplyPreview.swift @@ -21,7 +21,7 @@ class QuotedReplyPreview: UIView { @objc required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } @objc diff --git a/Signal/src/views/ReminderView.swift b/Signal/src/views/ReminderView.swift index a1ed1a648..f3d57eb83 100644 --- a/Signal/src/views/ReminderView.swift +++ b/Signal/src/views/ReminderView.swift @@ -32,12 +32,12 @@ class ReminderView: UIView { @available(*, unavailable, message:"use other constructor instead.") required init?(coder aDecoder: NSCoder) { - fatalError("\(#function) is unimplemented.") + notImplemented() } @available(*, unavailable, message:"use other constructor instead.") override init(frame: CGRect) { - fatalError("\(#function) is unimplemented.") + notImplemented() } private init(mode: ReminderViewMode, diff --git a/Signal/src/views/Toast.swift b/Signal/src/views/Toast.swift index 6692208a7..8444d3f82 100644 --- a/Signal/src/views/Toast.swift +++ b/Signal/src/views/Toast.swift @@ -48,7 +48,7 @@ class ToastView: UIView { } required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } // MARK: Gestures @@ -86,7 +86,7 @@ class ToastController: NSObject, ToastViewDelegate { } required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } // MARK: Public diff --git a/SignalMessaging/ViewControllers/AttachmentApprovalViewController.swift b/SignalMessaging/ViewControllers/AttachmentApprovalViewController.swift index b1f540b55..e1b7a5998 100644 --- a/SignalMessaging/ViewControllers/AttachmentApprovalViewController.swift +++ b/SignalMessaging/ViewControllers/AttachmentApprovalViewController.swift @@ -38,7 +38,7 @@ public class AttachmentApprovalViewController: OWSViewController, CaptioningTool @available(*, unavailable, message:"use attachment: constructor instead.") required public init?(coder aDecoder: NSCoder) { - fatalError("unimplemented") + notImplemented() } @objc @@ -494,7 +494,7 @@ class CaptioningToolbar: UIView, UITextViewDelegate { var textViewHeight: CGFloat required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } class MessageTextView: UITextView { diff --git a/SignalMessaging/ViewControllers/ContactFieldView.swift b/SignalMessaging/ViewControllers/ContactFieldView.swift index 9ad7d6a04..4e0fd5fdd 100644 --- a/SignalMessaging/ViewControllers/ContactFieldView.swift +++ b/SignalMessaging/ViewControllers/ContactFieldView.swift @@ -8,7 +8,7 @@ public class ContactFieldView: UIView { @available(*, unavailable, message: "use other constructor instead.") public required init?(coder aDecoder: NSCoder) { - fatalError("Unimplemented") + notImplemented() } public required init(rows: [UIView], hMargin: CGFloat) { diff --git a/SignalMessaging/ViewControllers/ContactShareApprovalViewController.swift b/SignalMessaging/ViewControllers/ContactShareApprovalViewController.swift index c75b2866a..e90ce3c30 100644 --- a/SignalMessaging/ViewControllers/ContactShareApprovalViewController.swift +++ b/SignalMessaging/ViewControllers/ContactShareApprovalViewController.swift @@ -159,7 +159,7 @@ class ContactShareFieldView: UIStackView { @available(*, unavailable, message: "use init(call:) constructor instead.") required init(coder aDecoder: NSCoder) { - fatalError("Unimplemented") + notImplemented() } required init(field: ContactShareField, previewViewBlock : @escaping (() -> UIView), delegate: ContactShareFieldViewDelegate) { @@ -236,7 +236,7 @@ public class ContactShareApprovalViewController: OWSViewController, EditContactS @available(*, unavailable, message:"use other constructor instead.") required public init?(coder aDecoder: NSCoder) { - fatalError("unimplemented") + notImplemented() } @objc diff --git a/SignalMessaging/ViewControllers/EditContactShareNameViewController.swift b/SignalMessaging/ViewControllers/EditContactShareNameViewController.swift index 7ad3070bd..20e88b5dd 100644 --- a/SignalMessaging/ViewControllers/EditContactShareNameViewController.swift +++ b/SignalMessaging/ViewControllers/EditContactShareNameViewController.swift @@ -26,7 +26,7 @@ class ContactNameFieldView: UIView { @available(*, unavailable, message: "use other constructor instead.") required init?(coder aDecoder: NSCoder) { - fatalError("Unimplemented") + notImplemented() } required init(name: String, value: String?, delegate: ContactNameFieldViewDelegate) { @@ -136,7 +136,7 @@ public class EditContactShareNameViewController: OWSViewController, ContactNameF @available(*, unavailable, message:"use other constructor instead.") required public init?(coder aDecoder: NSCoder) { - fatalError("unimplemented") + notImplemented() } @objc diff --git a/SignalMessaging/ViewControllers/MediaMessageView.swift b/SignalMessaging/ViewControllers/MediaMessageView.swift index e0a54844c..836649669 100644 --- a/SignalMessaging/ViewControllers/MediaMessageView.swift +++ b/SignalMessaging/ViewControllers/MediaMessageView.swift @@ -56,7 +56,7 @@ public class MediaMessageView: UIView, OWSAudioPlayerDelegate { @available(*, unavailable, message:"use other constructor instead.") required public init?(coder aDecoder: NSCoder) { - fatalError("\(#function) is unimplemented.") + notImplemented() } // Currently we only use one mode (AttachmentApproval), so we could simplify this class, but it's kind diff --git a/SignalMessaging/ViewControllers/MessageApprovalViewController.swift b/SignalMessaging/ViewControllers/MessageApprovalViewController.swift index 4a5e19ee2..29701a1b1 100644 --- a/SignalMessaging/ViewControllers/MessageApprovalViewController.swift +++ b/SignalMessaging/ViewControllers/MessageApprovalViewController.swift @@ -28,7 +28,7 @@ public class MessageApprovalViewController: OWSViewController, UITextViewDelegat @available(*, unavailable, message:"use attachment: constructor instead.") required public init?(coder aDecoder: NSCoder) { - fatalError("unimplemented") + notImplemented() } @objc diff --git a/SignalMessaging/ViewControllers/ModalActivityIndicatorViewController.swift b/SignalMessaging/ViewControllers/ModalActivityIndicatorViewController.swift index e41ce5b20..298ce238d 100644 --- a/SignalMessaging/ViewControllers/ModalActivityIndicatorViewController.swift +++ b/SignalMessaging/ViewControllers/ModalActivityIndicatorViewController.swift @@ -26,7 +26,7 @@ public class ModalActivityIndicatorViewController: OWSViewController { @available(*, unavailable, message:"use other constructor instead.") public required init?(coder aDecoder: NSCoder) { - fatalError("\(#function) is unimplemented.") + notImplemented() } public required init(canCancel: Bool) { diff --git a/SignalMessaging/Views/AvatarImageView.swift b/SignalMessaging/Views/AvatarImageView.swift index 263b4f2d8..a8a9585f3 100644 --- a/SignalMessaging/Views/AvatarImageView.swift +++ b/SignalMessaging/Views/AvatarImageView.swift @@ -92,7 +92,7 @@ public class ConversationAvatarImageView: AvatarImageView { } required public init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } @objc func handleSignalAccountsChanged(notification: Notification) { diff --git a/SignalMessaging/Views/DisappearingTimerConfigurationView.swift b/SignalMessaging/Views/DisappearingTimerConfigurationView.swift index ac82faf14..c74310fd8 100644 --- a/SignalMessaging/Views/DisappearingTimerConfigurationView.swift +++ b/SignalMessaging/Views/DisappearingTimerConfigurationView.swift @@ -49,7 +49,7 @@ public class DisappearingTimerConfigurationView: UIView { private var pressGesture: UILongPressGestureRecognizer! public required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } @objc diff --git a/SignalMessaging/Views/GradientView.swift b/SignalMessaging/Views/GradientView.swift index c0d256340..322cfc027 100644 --- a/SignalMessaging/Views/GradientView.swift +++ b/SignalMessaging/Views/GradientView.swift @@ -14,7 +14,7 @@ public class GradientView: UIView { } public required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } public override func layoutSubviews() { diff --git a/SignalMessaging/Views/OWSFlatButton.swift b/SignalMessaging/Views/OWSFlatButton.swift index 482a60d64..00e50409c 100644 --- a/SignalMessaging/Views/OWSFlatButton.swift +++ b/SignalMessaging/Views/OWSFlatButton.swift @@ -34,7 +34,7 @@ public class OWSFlatButton: UIView { @available(*, unavailable, message:"use other constructor instead.") required public init?(coder aDecoder: NSCoder) { - fatalError("\(#function) is unimplemented.") + notImplemented() } private func createContent() { diff --git a/SignalMessaging/Views/OWSNavigationBar.swift b/SignalMessaging/Views/OWSNavigationBar.swift index 97f9ff8f0..deae451a0 100644 --- a/SignalMessaging/Views/OWSNavigationBar.swift +++ b/SignalMessaging/Views/OWSNavigationBar.swift @@ -35,7 +35,7 @@ public class OWSNavigationBar: UINavigationBar { } public required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } @objc diff --git a/SignalMessaging/Views/TappableStackView.swift b/SignalMessaging/Views/TappableStackView.swift index 3daa3a4e4..27d66af81 100644 --- a/SignalMessaging/Views/TappableStackView.swift +++ b/SignalMessaging/Views/TappableStackView.swift @@ -12,7 +12,7 @@ public class TappableStackView: UIStackView { @available(*, unavailable, message: "use other constructor instead.") public required init(coder aDecoder: NSCoder) { - fatalError("Unimplemented") + notImplemented() } public required init(actionBlock : @escaping () -> Void) { diff --git a/SignalMessaging/Views/TappableView.swift b/SignalMessaging/Views/TappableView.swift index 3fab818a1..585410e45 100644 --- a/SignalMessaging/Views/TappableView.swift +++ b/SignalMessaging/Views/TappableView.swift @@ -11,7 +11,7 @@ public class TappableView: UIView { @available(*, unavailable, message: "use other constructor instead.") public required init?(coder aDecoder: NSCoder) { - fatalError("Unimplemented") + notImplemented() } public required init(actionBlock : @escaping () -> Void) { diff --git a/SignalMessaging/Views/VideoPlayerView.swift b/SignalMessaging/Views/VideoPlayerView.swift index 6a3f19ff3..283c72916 100644 --- a/SignalMessaging/Views/VideoPlayerView.swift +++ b/SignalMessaging/Views/VideoPlayerView.swift @@ -47,7 +47,7 @@ class TrackingSlider: UISlider { } required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } } @@ -98,7 +98,7 @@ public class PlayerProgressBar: UIView { } required public init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + notImplemented() } override public init(frame: CGRect) { diff --git a/SignalServiceKit/src/Util/OWSSwiftUtils.swift b/SignalServiceKit/src/Util/OWSSwiftUtils.swift index b8787ac93..c052b094b 100644 --- a/SignalServiceKit/src/Util/OWSSwiftUtils.swift +++ b/SignalServiceKit/src/Util/OWSSwiftUtils.swift @@ -20,10 +20,8 @@ public func assertOnQueue(_ queue: DispatchQueue) { public func AssertIsOnMainThread(file: String = #file, function: String = #function, line: Int = #line) { - guard Thread.isMainThread else { - let filename = (file as NSString).lastPathComponent - owsFail("\(filename):\(line) in \(function): Must be on main thread.") - return + if !Thread.isMainThread { + owsFail("Must be on main thread.", file: file, function: function, line: line) } } @@ -33,11 +31,10 @@ public func owsFail(_ logMessage: String, file: String = #file, function: String = #function, line: Int = #line) { - // TODO: Format using owsFormatLogMessage() once it is merged. - let message = "\(file) \(function) \(line): \(logMessage)" - Logger.error(message) + Logger.error(logMessage, file: file, function: function, line: line) Logger.flush() - assertionFailure(message) + let formattedMessage = owsFormatLogMessage(logMessage, file: file, function: function, line: line) + assertionFailure(formattedMessage) } // Once we're on Swift4.2 we can mark this as inlineable @@ -45,8 +42,17 @@ public func owsFail(_ logMessage: String, public func owsProdExit(_ logMessage: String, file: String = #file, function: String = #function, - line: Int = #line) { + line: Int = #line) -> Never { owsFail(logMessage, file: file, function: function, line: line) - fatalError(logMessage) + let formattedMessage = owsFormatLogMessage(logMessage, file: file, function: function, line: line) + fatalError(formattedMessage) +} + +// Once we're on Swift4.2 we can mark this as inlineable +// @inlinable +public func notImplemented(file: String = #file, + function: String = #function, + line: Int = #line) -> Never { + owsProdExit("Method not implemented.", file: file, function: function, line: line) } diff --git a/SignalShareExtension/SAEFailedViewController.swift b/SignalShareExtension/SAEFailedViewController.swift index 9b6b2bccc..98ea1219c 100644 --- a/SignalShareExtension/SAEFailedViewController.swift +++ b/SignalShareExtension/SAEFailedViewController.swift @@ -29,7 +29,7 @@ class SAEFailedViewController: UIViewController { @available(*, unavailable, message:"use other constructor instead.") required init?(coder aDecoder: NSCoder) { - fatalError("\(#function) is unimplemented.") + notImplemented() } override func loadView() { diff --git a/SignalShareExtension/SAELoadViewController.swift b/SignalShareExtension/SAELoadViewController.swift index 7a73f7303..ce5ebf518 100644 --- a/SignalShareExtension/SAELoadViewController.swift +++ b/SignalShareExtension/SAELoadViewController.swift @@ -50,7 +50,7 @@ class SAELoadViewController: UIViewController { @available(*, unavailable, message:"use other constructor instead.") required init?(coder aDecoder: NSCoder) { - fatalError("\(#function) is unimplemented.") + notImplemented() } override func loadView() {