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

Update to the latest version of SwiftFormat #250

Merged
merged 5 commits into from
Aug 5, 2020
Merged
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
7 changes: 5 additions & 2 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
--indent 2
--indentcase false
--trimwhitespace always
--empty tuple
--voidtype tuple
--nospaceoperators ..<,...
--ifdef noindent
--stripunusedargs closure-only
--maxwidth 100
--wraparguments before-first
--funcattributes prev-line
--disable andOperator
--swiftversion 5.2
--swiftversion 5.3
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ disabled_rules:
- type_name
- todo
- large_tuple
- opening_brace

line_length: 100

Expand Down
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"editor.formatOnSave": true,
"licenser.author": "Tokamak contributors"
"licenser.author": "Tokamak contributors",
"cSpell.words": [
"Tokamak"
]
}
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,18 @@ appreciated and helps in maintaining the project.

### Coding Style

This project uses [SwiftFormat](https://github.com/nicklockwood/SwiftFormat)
and [SwiftLint](https://github.com/realm/SwiftLint) to
enforce formatting and coding style. We encourage you to run SwiftFormat within
a local clone of the repository in whatever way works best for you either
manually or automatically via an [Xcode
extension](https://github.com/nicklockwood/SwiftFormat#xcode-source-editor-extension),
[build phase](https://github.com/nicklockwood/SwiftFormat#xcode-build-phase) or
[git pre-commit
hook](https://github.com/nicklockwood/SwiftFormat#git-pre-commit-hook) etc.

To guarantee that these tools run before you commit your changes on macOS, you're encouraged
to run this once to set up the [pre-commit](https://pre-commit.com/) hook:
This project uses [SwiftFormat](https://github.com/nicklockwood/SwiftFormat) and
[SwiftLint](https://github.com/realm/SwiftLint) to enforce formatting and coding style. SwiftFormat
0.45.3 and SwiftLint 0.39.2 or later versions are recommended. We encourage you to run SwiftFormat
and SwiftLint within a local clone of the repository in whatever way works best for you. You can do
that either manually, or automatically with VSCode extensions for
[SwiftFormat](https://github.com/vknabel/vscode-swiftformat) and
[SwiftLint](https://github.com/vknabel/vscode-swiftlint) respectively, or with the [Xcode
extension](https://github.com/nicklockwood/SwiftFormat#xcode-source-editor-extension), or [build
phase](https://github.com/nicklockwood/SwiftFormat#xcode-build-phase).

To guarantee that these tools run before you commit your changes on macOS, you're encouraged to run
this once to set up the [pre-commit](https://pre-commit.com/) hook:

```
brew bundle # installs SwiftLint, SwiftFormat and pre-commit
Expand Down
62 changes: 30 additions & 32 deletions Sources/TokamakCore/App/AppStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,50 +54,49 @@ import CombineShim
extension AppStorage: ObservedProperty {}

extension AppStorage {
public init(wrappedValue: Value,
_ key: String,
store: _StorageProvider? = nil) where Value == Bool {
public init(wrappedValue: Value, _ key: String, store: _StorageProvider? = nil)
where Value == Bool
{
defaultValue = wrappedValue
self.key = key
provider = store
self.store = { $0.store(key: $1, value: $2) }
read = { $0.read(key: $1) }
}

public init(wrappedValue: Value,
_ key: String,
store: _StorageProvider? = nil) where Value == Int {
public init(wrappedValue: Value, _ key: String, store: _StorageProvider? = nil)
where Value == Int
{
defaultValue = wrappedValue
self.key = key
provider = store
self.store = { $0.store(key: $1, value: $2) }
read = { $0.read(key: $1) }
}

public init(wrappedValue: Value,
_ key: String,
store: _StorageProvider? = nil) where Value == Double {
public init(wrappedValue: Value, _ key: String, store: _StorageProvider? = nil)
where Value == Double
{
defaultValue = wrappedValue
self.key = key
provider = store
self.store = { $0.store(key: $1, value: $2) }
read = { $0.read(key: $1) }
}

public init(wrappedValue: Value,
_ key: String,
store: _StorageProvider? = nil) where Value == String {
public init(wrappedValue: Value, _ key: String, store: _StorageProvider? = nil)
where Value == String
{
defaultValue = wrappedValue
self.key = key
provider = store
self.store = { $0.store(key: $1, value: $2) }
read = { $0.read(key: $1) }
}

public init(wrappedValue: Value,
_ key: String,
store: _StorageProvider? = nil)
where Value: RawRepresentable, Value.RawValue == Int {
public init(wrappedValue: Value, _ key: String, store: _StorageProvider? = nil)
where Value: RawRepresentable, Value.RawValue == Int
{
defaultValue = wrappedValue
self.key = key
provider = store
Expand All @@ -110,10 +109,9 @@ extension AppStorage {
}
}

public init(wrappedValue: Value,
_ key: String,
store: _StorageProvider? = nil)
where Value: RawRepresentable, Value.RawValue == String {
public init(wrappedValue: Value, _ key: String, store: _StorageProvider? = nil)
where Value: RawRepresentable, Value.RawValue == String
{
defaultValue = wrappedValue
self.key = key
provider = store
Expand All @@ -128,39 +126,39 @@ extension AppStorage {
}

extension AppStorage where Value: ExpressibleByNilLiteral {
public init(wrappedValue: Value,
_ key: String,
store: _StorageProvider? = nil) where Value == Bool? {
public init(wrappedValue: Value, _ key: String, store: _StorageProvider? = nil)
where Value == Bool?
{
defaultValue = wrappedValue
self.key = key
provider = store
self.store = { $0.store(key: $1, value: $2) }
read = { $0.read(key: $1) }
}

public init(wrappedValue: Value,
_ key: String,
store: _StorageProvider? = nil) where Value == Int? {
public init(wrappedValue: Value, _ key: String, store: _StorageProvider? = nil)
where Value == Int?
{
defaultValue = wrappedValue
self.key = key
provider = store
self.store = { $0.store(key: $1, value: $2) }
read = { $0.read(key: $1) }
}

public init(wrappedValue: Value,
_ key: String,
store: _StorageProvider? = nil) where Value == Double? {
public init(wrappedValue: Value, _ key: String, store: _StorageProvider? = nil)
where Value == Double?
{
defaultValue = wrappedValue
self.key = key
provider = store
self.store = { $0.store(key: $1, value: $2) }
read = { $0.read(key: $1) }
}

public init(wrappedValue: Value,
_ key: String,
store: _StorageProvider? = nil) where Value == String? {
public init(wrappedValue: Value, _ key: String, store: _StorageProvider? = nil)
where Value == String?
{
defaultValue = wrappedValue
self.key = key
provider = store
Expand Down
Loading