Skip to content

Commit

Permalink
Update to latest linters, add xcbeautify (#65)
Browse files Browse the repository at this point in the history
While we're here, we also fix a bug where the `avoidsKeyboard` parameter would be disregarded in a `BottomBarInstaller` initializer.
  • Loading branch information
erichoracek authored Dec 8, 2021
1 parent a6cf747 commit a527b22
Show file tree
Hide file tree
Showing 77 changed files with 472 additions and 260 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Build Package
run: bundle install && bundle exec rake build:package
run: brew install mint && bundle install && bundle exec rake build:package
build-example:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Build Example
run: bundle install && bundle exec rake build:example
run: brew install mint && bundle install && bundle exec rake build:example
test-package:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Test Package
run: bundle install && bundle exec rake test:package
run: brew install mint && bundle install && bundle exec rake test:package
lint-swift:
runs-on: macos-latest
steps:
Expand All @@ -36,4 +36,4 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Lint Podspec
run: bundle install && bundle exec rake lint:podspec
run: brew install mint && bundle install && bundle exec rake lint:podspec
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
as having a keyboard overlap when the keyboard is dismissed, resulting in incorrect keyboard
offsets.
- Fixes an issue when mutating state synchronously does not pick up the current SwiftUI transaction.
- Fixes a bug where the `avoidsKeyboard` parameter would be disregarded in a `BottomBarInstaller`
initializer.

### Changed
- Removed the default bar installer behavior where bar model updates were deferred while a view
Expand Down
4 changes: 2 additions & 2 deletions Example/EpoxyExample/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?)
_: UIApplication,
didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?)
-> Bool
{
window = UIWindow(frame: UIScreen.main.bounds)
Expand Down
2 changes: 1 addition & 1 deletion Example/EpoxyExample/Data/Example.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enum Example: CaseIterable {
case .swiftUIToEpoxy:
return "SwiftUI in Epoxy"
case .epoxyToSwiftUI:
return "Epoxy in SwiftUI"
return "Epoxy in SwiftUI"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ final class CardStackViewController: CollectionViewController {
content: .init(
models: [
ImageMarquee.barModel(
// swiftlint:disable:next force_unwrapping
content: .init(imageURL: URL(string: "https://picsum.photos/id/\(dataID + 310)/600/300")!),
style: .init(height: 150, contentMode: .scaleAspectFill))
.didSelect { _ in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class NavigationWrapperViewController: UIViewController {
navigationController.didMove(toParent: self)
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class ComplexDeclarativeViewController: UIViewController {
super.init(nibName: nil, bundle: nil)
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class LayoutGroupsReadmeExamplesViewController: CollectionViewController {
dataID: DataID.iconRow,
content: .init(
title: "This is an IconRow",
// swiftlint:disable:next force_unwrapping
icon: UIImage(systemName: "person.fill")!))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ final class ProductViewController: CollectionViewController {
@ItemModelBuilder private var items: [ItemModeling] {
ImageMarquee.itemModel(
dataID: DataID.Item.headerImage,
// swiftlint:disable:next force_unwrapping
content: .init(imageURL: URL(string: "https://picsum.photos/id/350/500/500")!),
style: .init(height: 250, contentMode: .scaleAspectFill))
TextRow.itemModel(
Expand All @@ -52,6 +53,7 @@ final class ProductViewController: CollectionViewController {
content: .init(
title: "Here is our exciting product",
subtitle: "We think you should buy it.",
// swiftlint:disable:next force_unwrapping
imageURL: URL(string: "https://picsum.photos/id/350/500/500")!))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class EpoxyInSwiftUIViewController: UIHostingController<EpoxyInSwiftUIView
super.init(rootView: EpoxyInSwiftUIView())
}

required init?(coder aDecoder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
Expand Down
4 changes: 2 additions & 2 deletions Example/EpoxyExample/Views/ButtonRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class ButtonRow: UIView, EpoxyableView {
setUp()
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand All @@ -27,7 +27,7 @@ final class ButtonRow: UIView, EpoxyableView {
var text: String?
}

func setContent(_ content: Content, animated: Bool) {
func setContent(_ content: Content, animated _: Bool) {
text = content.text
}

Expand Down
2 changes: 1 addition & 1 deletion Example/EpoxyExample/Views/CardContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class CardContainer<ContentView: EpoxyableView>: UIView, EpoxyableView {
applyStyle()
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand Down
2 changes: 1 addition & 1 deletion Example/EpoxyExample/Views/ColorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class ColorView: UIView, EpoxyableView {
backgroundColor = style.color
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand Down
4 changes: 2 additions & 2 deletions Example/EpoxyExample/Views/CustomSizingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class CustomSizingView: UIView, EpoxyableView {
setUpViews()
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand Down Expand Up @@ -80,7 +80,7 @@ private class SizingLabel: UILabel {
return contentSize?(constrainingWidth) ?? .zero
}

override func draw(_ rect: CGRect) {
override func draw(_: CGRect) {
// Do nothing here, the label is only used for sizing
}
}
4 changes: 2 additions & 2 deletions Example/EpoxyExample/Views/ImageMarquee.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class ImageMarquee: UIView, EpoxyableView {
constrainSubviews()
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand All @@ -32,7 +32,7 @@ final class ImageMarquee: UIView, EpoxyableView {
var imageURL: URL?
}

func setContent(_ content: Content, animated: Bool) {
func setContent(_ content: Content, animated _: Bool) {
imageView.setURL(content.imageURL)
}

Expand Down
4 changes: 2 additions & 2 deletions Example/EpoxyExample/Views/ImageRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class ImageRow: UIView, EpoxyableView {
setUp()
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand All @@ -26,7 +26,7 @@ final class ImageRow: UIView, EpoxyableView {
let imageURL: URL
}

func setContent(_ content: Content, animated: Bool) {
func setContent(_ content: Content, animated _: Bool) {
titleLabel.text = content.title
subtitleLabel.text = content.subtitle
imageView.setURL(content.imageURL)
Expand Down
4 changes: 2 additions & 2 deletions Example/EpoxyExample/Views/LayoutGroups/ActionButtonRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class ActionButtonRow: BaseRow, EpoxyableView {
setUp()
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand All @@ -32,7 +32,7 @@ final class ActionButtonRow: BaseRow, EpoxyableView {
case action
}

func setContent(_ content: Content, animated: Bool) {
func setContent(_ content: Content, animated _: Bool) {
group.setItems {
Label.groupItem(
dataID: DataID.title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class AlignableTextRow: BaseRow, EpoxyableView {
setUp()
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand All @@ -27,15 +27,15 @@ final class AlignableTextRow: BaseRow, EpoxyableView {

struct Style: Hashable {
var titleAlignment: VGroup.ItemAlignment = .leading
var showLabelBackgrounds: Bool = false
var showLabelBackgrounds = false
}

struct Content: Equatable {
let title: String
let subtitle: String?
}

func setContent(_ content: Content, animated: Bool) {
func setContent(_ content: Content, animated _: Bool) {
let showLabelBackgrounds = style.showLabelBackgrounds

group.setItems {
Expand Down
4 changes: 2 additions & 2 deletions Example/EpoxyExample/Views/LayoutGroups/CheckboxRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class CheckboxRow: BaseRow, EpoxyableView {
setUp()
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand All @@ -33,7 +33,7 @@ final class CheckboxRow: BaseRow, EpoxyableView {
case subtitle
}

func setContent(_ content: Content, animated: Bool) {
func setContent(_ content: Content, animated _: Bool) {
group.setItems {
IconView.groupItem(
dataID: DataID.checkbox,
Expand Down
2 changes: 1 addition & 1 deletion Example/EpoxyExample/Views/LayoutGroups/ColorsRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class ColorsRow: BaseRow, EpoxyableView {
setUp()
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand Down
4 changes: 2 additions & 2 deletions Example/EpoxyExample/Views/LayoutGroups/DynamicRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class DynamicRow: BaseRow, EpoxyableView {
layout.constrainToMarginsWithHighPriorityBottom()
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand All @@ -37,7 +37,7 @@ final class DynamicRow: BaseRow, EpoxyableView {
let didTapOption: ((String) -> Void)?
}

func setContent(_ content: Content, animated: Bool) {
func setContent(_ content: Content, animated _: Bool) {
layout.setItems {
Label.groupItem(
dataID: DataID.title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class BaseRow: UIView {
layoutMargins = UIEdgeInsets(top: 16, left: 24, bottom: 16, right: 24)
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
4 changes: 2 additions & 2 deletions Example/EpoxyExample/Views/LayoutGroups/Elements/Button.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class Button: UIButton, EpoxyableView {
for: .touchUpInside)
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand All @@ -39,7 +39,7 @@ final class Button: UIButton, EpoxyableView {
let didTap: (UIButton) -> Void
}

func setContent(_ content: Content, animated: Bool) {
func setContent(_ content: Content, animated _: Bool) {
setTitle(content.title, for: .normal)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class IconView: UIImageView, EpoxyableView {
setContent(image, animated: false)
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand All @@ -47,7 +47,7 @@ final class IconView: UIImageView, EpoxyableView {
size
}

func setContent(_ content: UIImage?, animated: Bool) {
func setContent(_ content: UIImage?, animated _: Bool) {
image = content
}

Expand Down
4 changes: 2 additions & 2 deletions Example/EpoxyExample/Views/LayoutGroups/Elements/Label.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class Label: UILabel, EpoxyableView {
}
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand All @@ -38,7 +38,7 @@ final class Label: UILabel, EpoxyableView {

typealias Content = String

func setContent(_ content: String, animated: Bool) {
func setContent(_ content: String, animated _: Bool) {
text = content
}

Expand Down
4 changes: 2 additions & 2 deletions Example/EpoxyExample/Views/LayoutGroups/IconRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class IconRow: BaseRow, EpoxyableView {
setUp()
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand All @@ -25,7 +25,7 @@ final class IconRow: BaseRow, EpoxyableView {
let icon: UIImage
}

func setContent(_ content: Content, animated: Bool) {
func setContent(_ content: Content, animated _: Bool) {
imageView.image = content.icon
titleLabel.text = content.title
}
Expand Down
4 changes: 2 additions & 2 deletions Example/EpoxyExample/Views/LayoutGroups/MessageRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class MessageRow: BaseRow, EpoxyableView {
setUp()
}

required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand Down Expand Up @@ -47,7 +47,7 @@ final class MessageRow: BaseRow, EpoxyableView {
case topSpacer
}

func setContent(_ content: Content, animated: Bool) {
func setContent(_ content: Content, animated _: Bool) {
group.setItems {
IconView.groupItem(
dataID: DataID.avatar,
Expand Down
Loading

0 comments on commit a527b22

Please sign in to comment.