From 3c986f3bd8ea6df8f66bc4c4a6c4cb765f7585b7 Mon Sep 17 00:00:00 2001 From: Igor Kulman Date: Sat, 13 Jan 2024 11:37:21 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Code=20style=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewControllers/AboutViewController.swift | 12 ++++++------ .../ViewControllers/DetailViewController.swift | 14 +++++++------- .../ViewControllers/FeedViewController.swift | 8 ++++---- .../Scenarios/Setup/Cells/RssSourceCell.swift | 8 ++++---- .../CustomSourceViewController.swift | 16 ++++++++-------- .../SourceSelectionViewController.swift | 8 ++++---- .../Scenarios/Setup/Views/FormFieldView.swift | 6 +++--- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Sources/iOSSampleApp/Scenarios/About/ViewControllers/AboutViewController.swift b/Sources/iOSSampleApp/Scenarios/About/ViewControllers/AboutViewController.swift index 25ae204..d2db73e 100644 --- a/Sources/iOSSampleApp/Scenarios/About/ViewControllers/AboutViewController.swift +++ b/Sources/iOSSampleApp/Scenarios/About/ViewControllers/AboutViewController.swift @@ -32,28 +32,28 @@ final class AboutViewController: UITableViewController { // MARK: - UI - private lazy var titleLabel: UILabel = .init() &> { + private lazy var titleLabel = UILabel() &> { $0.textAlignment = .center $0.font = UIFont.preferredFont(forTextStyle: .headline) } - private lazy var versionLabel: UILabel = .init() &> { + private lazy var versionLabel = UILabel() &> { $0.textAlignment = .center $0.font = UIFont.preferredFont(forTextStyle: .caption2) } - private lazy var logoImageView: UIImageView = .init() &> { + private lazy var logoImageView = UIImageView() &> { $0.image = .logo $0.contentMode = .scaleAspectFit $0.fixSize(width: 48, height: 48) } - private lazy var headerView: UIView = .init() &> { - let textsStackView: UIStackView = .init(arrangedSubviews: [titleLabel, versionLabel]) &> { + private lazy var headerView = UIView() &> { + let textsStackView = UIStackView(arrangedSubviews: [titleLabel, versionLabel]) &> { $0.axis = .vertical } - let stackView: UIStackView = .init(arrangedSubviews: [logoImageView, textsStackView]) &> { + let stackView = UIStackView(arrangedSubviews: [logoImageView, textsStackView]) &> { $0.translatesAutoresizingMaskIntoConstraints = false $0.axis = .vertical $0.spacing = 8 diff --git a/Sources/iOSSampleApp/Scenarios/Feed/ViewControllers/DetailViewController.swift b/Sources/iOSSampleApp/Scenarios/Feed/ViewControllers/DetailViewController.swift index 63e82db..deb05e6 100644 --- a/Sources/iOSSampleApp/Scenarios/Feed/ViewControllers/DetailViewController.swift +++ b/Sources/iOSSampleApp/Scenarios/Feed/ViewControllers/DetailViewController.swift @@ -22,25 +22,25 @@ final class DetailViewController: UIViewController { // MARK: - UI - private lazy var backBarButtonItem: UIBarButtonItem = .init() &> { + private lazy var backBarButtonItem = UIBarButtonItem() &> { $0.image = .back $0.style = .plain } - private lazy var forwardBarButtonItem: UIBarButtonItem = .init() &> { + private lazy var forwardBarButtonItem = UIBarButtonItem() &> { $0.image = .forward $0.style = .plain } - private lazy var reloadBarButtonItem: UIBarButtonItem = .init(barButtonSystemItem: .refresh, target: self, action: nil) + private lazy var reloadBarButtonItem = UIBarButtonItem(barButtonSystemItem: .refresh, target: self, action: nil) - private lazy var stopBarButtonItem: UIBarButtonItem = .init(barButtonSystemItem: .stop, target: self, action: nil) + private lazy var stopBarButtonItem = UIBarButtonItem(barButtonSystemItem: .stop, target: self, action: nil) - private lazy var doneBarButtonItem: UIBarButtonItem = .init(barButtonSystemItem: .stop, target: self, action: nil) + private lazy var doneBarButtonItem = UIBarButtonItem(barButtonSystemItem: .stop, target: self, action: nil) - private lazy var flexibleSpaceBarButtonItem: UIBarButtonItem = .init(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) + private lazy var flexibleSpaceBarButtonItem = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) - private lazy var progressView: UIProgressView = .init(progressViewStyle: .default) &> { + private lazy var progressView = UIProgressView(progressViewStyle: .default) &> { $0.trackTintColor = .clear } diff --git a/Sources/iOSSampleApp/Scenarios/Feed/ViewControllers/FeedViewController.swift b/Sources/iOSSampleApp/Scenarios/Feed/ViewControllers/FeedViewController.swift index e688bb2..a0afeab 100644 --- a/Sources/iOSSampleApp/Scenarios/Feed/ViewControllers/FeedViewController.swift +++ b/Sources/iOSSampleApp/Scenarios/Feed/ViewControllers/FeedViewController.swift @@ -32,23 +32,23 @@ final class FeedViewController: UIViewController, ToastCapable { // MARK: - UI - private lazy var tableView: UITableView = .init() &> { + private lazy var tableView = UITableView() &> { $0.estimatedRowHeight = 0 $0.rowHeight = 100 $0.refreshControl = refreshControl $0.tableFooterView = UIView() } - private lazy var refreshControl: UIRefreshControl = .init() &> { + private lazy var refreshControl = UIRefreshControl() &> { $0.attributedTitle = NSAttributedString(string: L10n.pullToRefresh) } - private lazy var setupButton: UIBarButtonItem = .init() &> { + private lazy var setupButton = UIBarButtonItem() &> { $0.image = .settings $0.style = .plain } - private lazy var aboutButton: UIBarButtonItem = .init() &> { + private lazy var aboutButton = UIBarButtonItem() &> { $0.image = .about $0.style = .plain $0.accessibilityIdentifier = "about" diff --git a/Sources/iOSSampleApp/Scenarios/Setup/Cells/RssSourceCell.swift b/Sources/iOSSampleApp/Scenarios/Setup/Cells/RssSourceCell.swift index 600ef62..7cce095 100644 --- a/Sources/iOSSampleApp/Scenarios/Setup/Cells/RssSourceCell.swift +++ b/Sources/iOSSampleApp/Scenarios/Setup/Cells/RssSourceCell.swift @@ -14,16 +14,16 @@ final class RssSourceCell: UITableViewCell, Reusable { // MARK: - UI - private lazy var logoImage: UIImageView = .init() &> { + private lazy var logoImage = UIImageView() &> { $0.contentMode = .scaleAspectFit $0.fixSize(width: 36, height: 36) } - private lazy var titleLabel: UILabel = .init() &> { + private lazy var titleLabel = UILabel() &> { $0.font = UIFont.preferredFont(forTextStyle: .body) } - private lazy var urlLabel: UILabel = .init() &> { + private lazy var urlLabel = UILabel() &> { $0.font = UIFontMetrics.default.scaledFont(for: UIFont.systemFont(ofSize: 12)) $0.adjustsFontForContentSizeCategory = true } @@ -67,7 +67,7 @@ final class RssSourceCell: UITableViewCell, Reusable { preservesSuperviewLayoutMargins = true contentView.preservesSuperviewLayoutMargins = true - let stackView: UIStackView = .init(arrangedSubviews: [titleLabel, urlLabel]) &> { + let stackView = UIStackView(arrangedSubviews: [titleLabel, urlLabel]) &> { $0.translatesAutoresizingMaskIntoConstraints = false $0.axis = .vertical } diff --git a/Sources/iOSSampleApp/Scenarios/Setup/ViewControllers/CustomSourceViewController.swift b/Sources/iOSSampleApp/Scenarios/Setup/ViewControllers/CustomSourceViewController.swift index b0f8e6e..57b7b58 100644 --- a/Sources/iOSSampleApp/Scenarios/Setup/ViewControllers/CustomSourceViewController.swift +++ b/Sources/iOSSampleApp/Scenarios/Setup/ViewControllers/CustomSourceViewController.swift @@ -23,28 +23,28 @@ final class CustomSourceViewController: UIViewController { // MARK: - UI - private lazy var doneButton: UIBarButtonItem = .init() &> { + private lazy var doneButton = UIBarButtonItem() &> { $0.title = L10n.done $0.style = .plain } - private lazy var rssUrlFormField: FormFieldView = .init() &> { + private lazy var rssUrlFormField = FormFieldView() &> { $0.title = L10n.rssUrl } - private lazy var urlFormField: FormFieldView = .init() &> { + private lazy var urlFormField = FormFieldView() &> { $0.title = L10n.url } - private lazy var titleFormField: FormFieldView = .init() &> { + private lazy var titleFormField = FormFieldView() &> { $0.title = L10n.title } - private lazy var logoUrlFormField: FormFieldView = .init() &> { + private lazy var logoUrlFormField = FormFieldView() &> { $0.title = "\(L10n.logoUrl) (\(L10n.optional))" } - private lazy var scrollView: UIScrollView = .init() &> { + private lazy var scrollView = UIScrollView() &> { $0.backgroundColor = .systemBackground } @@ -73,12 +73,12 @@ final class CustomSourceViewController: UIViewController { let view = UIView() defer { self.view = view } - let stackView: UIStackView = .init(arrangedSubviews: [titleFormField, urlFormField, rssUrlFormField, logoUrlFormField]) &> { + let stackView = UIStackView(arrangedSubviews: [titleFormField, urlFormField, rssUrlFormField, logoUrlFormField]) &> { $0.axis = .vertical $0.spacing = 12 } - let contentView: UIView = .init() &> { + let contentView = UIView() &> { stackView.pin(to: $0, guide: $0.layoutMarginsGuide, insets: .init(all: 8)) } diff --git a/Sources/iOSSampleApp/Scenarios/Setup/ViewControllers/SourceSelectionViewController.swift b/Sources/iOSSampleApp/Scenarios/Setup/ViewControllers/SourceSelectionViewController.swift index c7b39ba..c99c51e 100644 --- a/Sources/iOSSampleApp/Scenarios/Setup/ViewControllers/SourceSelectionViewController.swift +++ b/Sources/iOSSampleApp/Scenarios/Setup/ViewControllers/SourceSelectionViewController.swift @@ -25,23 +25,23 @@ final class SourceSelectionViewController: UIViewController { // MARK: - UI - private lazy var tableView: UITableView = .init() &> { + private lazy var tableView = UITableView() &> { $0.rowHeight = 60 $0.tableFooterView = UIView() } - private lazy var doneButton: UIBarButtonItem = .init() &> { + private lazy var doneButton = UIBarButtonItem() &> { $0.title = L10n.done $0.style = .plain $0.accessibilityIdentifier = "done" } - private lazy var addCustomButton: UIBarButtonItem = .init() &> { + private lazy var addCustomButton = UIBarButtonItem() &> { $0.title = L10n.addCustom $0.style = .plain } - private lazy var searchController: UISearchController = .init() + private lazy var searchController = UISearchController() // MARK: - Properties diff --git a/Sources/iOSSampleApp/Scenarios/Setup/Views/FormFieldView.swift b/Sources/iOSSampleApp/Scenarios/Setup/Views/FormFieldView.swift index 4c99170..490f33f 100644 --- a/Sources/iOSSampleApp/Scenarios/Setup/Views/FormFieldView.swift +++ b/Sources/iOSSampleApp/Scenarios/Setup/Views/FormFieldView.swift @@ -15,11 +15,11 @@ final class FormFieldView: UIView { // MARK: - UI - private lazy var label: UILabel = .init() &> { + private lazy var label = UILabel() &> { $0.font = UIFont.preferredFont(forTextStyle: .body) } - fileprivate lazy var textField: UITextField = .init() &> { + fileprivate lazy var textField = UITextField() &> { $0.borderStyle = .roundedRect $0.font = UIFont.preferredFont(forTextStyle: .body) } @@ -63,7 +63,7 @@ final class FormFieldView: UIView { } private func setup() { - let stackView: UIStackView = .init(arrangedSubviews: [label, textField]) &> { + let stackView = UIStackView(arrangedSubviews: [label, textField]) &> { $0.axis = .vertical $0.spacing = 6 }