Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check formatting on PR or push to master #40

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/swiftformat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: swiftformat

on:
push:
branches: ["master"]

pull_request:
branches: ["master"]

jobs:
swiftformat:
name: swiftformat
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install SwiftFormat
uses: Cyberbeni/install-swift-tool@v2
with:
url: https://github.com/nicklockwood/SwiftFormat
version: 0.49.2
- name: Check formatting
run: swiftformat --lint .
1 change: 1 addition & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--ifdef no-indent
15 changes: 8 additions & 7 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import PackageDescription

let package = Package(
name: "MosaiqueAssetsPicker",
platforms: [
.iOS(.v10)
platforms: [
.iOS(.v10),
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "MosaiqueAssetsPicker",
targets: ["MosaiqueAssetsPicker"]),
targets: ["MosaiqueAssetsPicker"]
),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
Expand All @@ -25,14 +26,14 @@ let package = Package(
name: "MosaiqueAssetsPicker",
dependencies: [],
path: "Sources/MosaiqueAssetsPicker",
exclude:["Info.plist"]
),
exclude: ["Info.plist"]
),
.testTarget(
name: "MosaiqueAssetsPickerTests",
dependencies: ["MosaiqueAssetsPicker"],
path: "Tests/AssetsPickerTests",
exclude:["Info.plist"]
),
exclude: ["Info.plist"]
),
],
swiftLanguageVersions: [.v5]
)
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public final class AssetDetailViewModel: NSObject {
let dispatchGroup = DispatchGroup()
var images: [UIImage] = []

let assetsDownloads = selectionContainer.selectedItems.map { (cellViewModel) -> AssetFuture in
let assetsDownloads = selectionContainer.selectedItems.map { cellViewModel -> AssetFuture in
dispatchGroup.enter()
return cellViewModel.download(onNext: { image in
DispatchQueue.main.async {
Expand Down
2 changes: 1 addition & 1 deletion Sources/MosaiqueAssetsPicker/Views/AssetDetailCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ final class AssetDetailCell: UICollectionViewCell, AssetDetailCellBindable {

func setDownloading(_ isDownloading: Bool) {
if isDownloading {
let spinner = self.spinner ?? {
let spinner = spinner ?? {
let spinner = UIActivityIndicatorView(style: .whiteLarge)
self.spinner = spinner
return spinner
Expand Down
2 changes: 1 addition & 1 deletion Sources/MosaiqueAssetsPicker/Views/GradientView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class GradiantView: UIView {

required init(colors: [CGColor], startPoint: CGPoint, endPoint: CGPoint, type: CAGradientLayerType, locations: [NSNumber]?) {
super.init(frame: .zero)
guard let layer = self.layer as? CAGradientLayer else {
guard let layer = layer as? CAGradientLayer else {
assertionFailure("should be of CAGradientLayer")
return
}
Expand Down