Skip to content

Commit 5731d20

Browse files
maximkroukgithub-actions[bot]
authored andcommitted
style(ci): run swiftformat
1 parent c729a3a commit 5731d20

File tree

10 files changed

+64
-62
lines changed

10 files changed

+64
-62
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ let package = Package(
6767
.target(
6868
name: "FunctionalKeyPath",
6969
dependencies: [
70-
.target(name: "FunctionalModification")
70+
.target(name: "FunctionalModification"),
7171
]
7272
),
7373
.target(name: "FunctionalModification"),
7474
.testTarget(
7575
name: "DeclarativeConfigurationTests",
7676
dependencies: [
77-
.target(name: "DeclarativeConfiguration")
77+
.target(name: "DeclarativeConfiguration"),
7878
]
7979
),
8080
]

Sources/FunctionalBuilder/Builder.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ public struct Builder<Base> {
7777
_ initialValue: @escaping () -> Base,
7878
_ configurator: Configurator<Base>
7979
) {
80-
_initialValue = initialValue
81-
_configurator = configurator
80+
self._initialValue = initialValue
81+
self._configurator = configurator
8282
}
8383

8484
/// Appends transformation to current configuration
@@ -126,7 +126,6 @@ public struct Builder<Base> {
126126
keyPath: FunctionalKeyPath.getonly(keyPath).optional()
127127
)
128128
}
129-
130129
}
131130

132131
extension Builder {

Sources/FunctionalClosures/DataSource.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
@propertyWrapper
55
public class DataSource<Input, Output> {
66
public struct Container {
7-
internal var action: ((Input) -> Output)
7+
internal var action: (Input) -> Output
88

99
public init(action: @escaping (Input) -> Output) {
1010
self.action = action

Sources/FunctionalClosures/Handler.swift

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ public class Handler<Input> {
2020
*,
2121
deprecated,
2222
message:
23-
"""
24-
This API will be removed, \
25-
consider using redeclaration with `(Input) -> Output` signature function. \
26-
Feel free to discuss the API here \
27-
https://github.com/MakeupStudio/swift-declarative-configuration/issues/1
28-
"""
23+
"""
24+
This API will be removed, \
25+
consider using redeclaration with `(Input) -> Output` signature function. \
26+
Feel free to discuss the API here \
27+
https://github.com/MakeupStudio/swift-declarative-configuration/issues/1
28+
"""
2929
)
3030
public mutating func callAsFunction(_ behaviour: Behaviour, perform action: ((Input) -> Void)?)
3131
{
@@ -100,12 +100,12 @@ public class Handler2<T0, T1> {
100100
*,
101101
deprecated,
102102
message:
103-
"""
104-
This API will be removed, \
105-
consider using redeclaration with `(Input) -> Output` signature function. \
106-
Feel free to discuss the API here \
107-
https://github.com/MakeupStudio/swift-declarative-configuration/issues/1
108-
"""
103+
"""
104+
This API will be removed, \
105+
consider using redeclaration with `(Input) -> Output` signature function. \
106+
Feel free to discuss the API here \
107+
https://github.com/MakeupStudio/swift-declarative-configuration/issues/1
108+
"""
109109
)
110110
public mutating func callAsFunction(_ behaviour: Behaviour, perform action: ((T0, T1) -> Void)?)
111111
{
@@ -174,12 +174,12 @@ public class Handler3<T0, T1, T2> {
174174
*,
175175
deprecated,
176176
message:
177-
"""
178-
This API will be removed, \
179-
consider using redeclaration with `(Input) -> Output` signature function. \
180-
Feel free to discuss the API here \
181-
https://github.com/MakeupStudio/swift-declarative-configuration/issues/1
182-
"""
177+
"""
178+
This API will be removed, \
179+
consider using redeclaration with `(Input) -> Output` signature function. \
180+
Feel free to discuss the API here \
181+
https://github.com/MakeupStudio/swift-declarative-configuration/issues/1
182+
"""
183183
)
184184
public mutating func callAsFunction(
185185
_ behaviour: Behaviour,
@@ -250,12 +250,12 @@ public class Handler4<T0, T1, T2, T3> {
250250
*,
251251
deprecated,
252252
message:
253-
"""
254-
This API will be removed, \
255-
consider using redeclaration with `(Input) -> Output` signature function. \
256-
Feel free to discuss the API here \
257-
https://github.com/MakeupStudio/swift-declarative-configuration/issues/1
258-
"""
253+
"""
254+
This API will be removed, \
255+
consider using redeclaration with `(Input) -> Output` signature function. \
256+
Feel free to discuss the API here \
257+
https://github.com/MakeupStudio/swift-declarative-configuration/issues/1
258+
"""
259259
)
260260
public mutating func callAsFunction(
261261
_ behaviour: Behaviour,
@@ -326,12 +326,12 @@ public class Handler5<T0, T1, T2, T3, T4> {
326326
*,
327327
deprecated,
328328
message:
329-
"""
330-
This API will be removed, \
331-
consider using redeclaration with `(Input) -> Output` signature function. \
332-
Feel free to discuss the API here \
333-
https://github.com/MakeupStudio/swift-declarative-configuration/issues/1
334-
"""
329+
"""
330+
This API will be removed, \
331+
consider using redeclaration with `(Input) -> Output` signature function. \
332+
Feel free to discuss the API here \
333+
https://github.com/MakeupStudio/swift-declarative-configuration/issues/1
334+
"""
335335
)
336336
public mutating func callAsFunction(
337337
_ behaviour: Behaviour,

Sources/FunctionalConfigurator/Configurator.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public struct Configurator<Base> {
99
///
1010
/// Newly created configurator has no modification set up.
1111
/// So it's `configure` function does not modify input
12-
public init() { _configure = { $0 } }
12+
public init() { self._configure = { $0 } }
1313

1414
/// Creates a configurator with a configuration function
1515
///
@@ -122,7 +122,6 @@ public struct Configurator<Base> {
122122
public static func set(_ transform: @escaping (inout Base) -> Void) -> Configurator {
123123
Configurator().set(transform)
124124
}
125-
126125
}
127126

128127
extension Configurator {

Sources/FunctionalConfigurator/Modification.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
*,
77
deprecated,
88
message:
9-
"""
10-
This function will be made internal in `1.0.0` release, implement `CustomConfigurable` protocol for your object and use instance method instead
11-
"""
9+
"""
10+
This function will be made internal in `1.0.0` release, implement `CustomConfigurable` protocol for your object and use instance method instead
11+
"""
1212
)
1313
@inlinable
1414
public func modification<Object>(

Sources/FunctionalKeyPath/FunctionalKeyPath.swift

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public struct FunctionalKeyPath<Root, Value> {
4747
@inlinable
4848
public static func getonly(_ keyPath: KeyPath<Root, Value>) -> FunctionalKeyPath {
4949
FunctionalKeyPath(
50-
embed: { value, root in
51-
return root
50+
embed: { _, root in
51+
root
5252
},
5353
extract: { root in
5454
root[keyPath: keyPath]
@@ -77,7 +77,7 @@ public struct FunctionalKeyPath<Root, Value> {
7777
/// - Parameter value: A value to embed.
7878
/// - Returns: A root that embeds `value`.
7979
public func embed(_ value: Value, in root: Root) -> Root {
80-
self._embed(value, root)
80+
_embed(value, root)
8181
}
8282

8383
/// Returns a root by embedding a value.
@@ -86,15 +86,15 @@ public struct FunctionalKeyPath<Root, Value> {
8686
///
8787
/// - Parameter value: A value to embed.
8888
public func embed(_ value: Value, in root: inout Root) {
89-
root = self.embed(value, in: root)
89+
root = embed(value, in: root)
9090
}
9191

9292
/// Attempts to extract a value from a root.
9393
///
9494
/// - Parameter root: A root to extract from.
9595
/// - Returns: A value iff it can be extracted from the given root, otherwise `nil`.
9696
public func extract(from root: Root) -> Value {
97-
self._extract(root)
97+
_extract(root)
9898
}
9999

100100
/// Returns a new functional keyPath created by appending the given functional keyPath to this one.
@@ -143,7 +143,8 @@ extension FunctionalKeyPath {
143143
public static func key<Key: Hashable, _Value>(
144144
_ key: Key
145145
) -> FunctionalKeyPath
146-
where Root == [Key: _Value], Value == _Value? {
146+
where Root == [Key: _Value], Value == _Value?
147+
{
147148
FunctionalKeyPath(
148149
embed: { value, root in
149150
modification(of: root) { $0[key] = value }
@@ -153,7 +154,8 @@ extension FunctionalKeyPath {
153154
}
154155

155156
public static func index(_ index: Root.Index) -> FunctionalKeyPath
156-
where Root: MutableCollection, Value == Root.Element {
157+
where Root: MutableCollection, Value == Root.Element
158+
{
157159
FunctionalKeyPath(
158160
embed: { value, root in
159161
modification(of: root) { root in
@@ -167,15 +169,17 @@ extension FunctionalKeyPath {
167169
}
168170

169171
public static func getonlyIndex(_ index: Root.Index) -> FunctionalKeyPath
170-
where Root: Collection, Value == Root.Element {
172+
where Root: Collection, Value == Root.Element
173+
{
171174
FunctionalKeyPath(
172-
embed: { _, root in return root },
175+
embed: { _, root in root },
173176
extract: { $0[index] }
174177
)
175178
}
176179

177180
public static func safeIndex(_ index: Root.Index) -> FunctionalKeyPath<Root, Value?>
178-
where Root == [Value] {
181+
where Root == [Value]
182+
{
179183
FunctionalKeyPath<Root, Value?>(
180184
embed: { value, root in
181185
modification(of: root) { root in
@@ -187,7 +191,7 @@ extension FunctionalKeyPath {
187191
}
188192
},
189193
extract: { root in
190-
return root.indices.contains(index)
194+
root.indices.contains(index)
191195
? root[index]
192196
: nil
193197
}

Tests/DeclarativeConfigurationTests/BuilderTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ final class BuilderTests: XCTestCase {
7373
var b: Int = 0
7474
var c: Int = 0
7575
let innerClass: InnerClass? = nil
76-
var innerStruct: InnerStruct? = nil
76+
var innerStruct: InnerStruct?
7777

7878
init() {}
7979
}

Tests/DeclarativeConfigurationTests/ConfiguratorTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class ConfiguratorTests: XCTestCase {
2121

2222
let configurator =
2323
wrappedConfiguator
24-
.combined(with: valueConfigurator)
24+
.combined(with: valueConfigurator)
2525

2626
let initial = TestConfigurable()
2727
let expected = TestConfigurable(value: true, wrapped: .init(value: 1))
@@ -99,7 +99,7 @@ final class ConfiguratorTests: XCTestCase {
9999
struct TestConfigurable: CustomConfigurable {
100100
internal init(value: Bool = false, wrappedValue: Int = 0) {
101101
self.value = value
102-
self.wrapped?.value = wrappedValue
102+
wrapped?.value = wrappedValue
103103
}
104104

105105
class Wrapped: NSObject {
@@ -108,7 +108,7 @@ final class ConfiguratorTests: XCTestCase {
108108
}
109109

110110
var value = false
111-
let _wrapped: Wrapped = Wrapped()
111+
let _wrapped: Wrapped = .init()
112112
var wrapped: Wrapped? { _wrapped }
113113
}
114114

@@ -141,7 +141,7 @@ final class ConfiguratorTests: XCTestCase {
141141
var b: Int = 0
142142
var c: Int = 0
143143
let innerClass: InnerClass? = nil
144-
var innerStruct: InnerStruct? = nil
144+
var innerStruct: InnerStruct?
145145

146146
init() {}
147147
}

Tests/DeclarativeConfigurationTests/FunctionalClosuresTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ final class FunctionalClosuresTests: XCTestCase {
77
func testBasicUsage() {
88
class Object: NSObject {
99
@DataSource<(Int, Int), Int>
10-
var sum = .init { $0 + $1 } // You can specify default handler
10+
var sum = .init { $0 + $1 } // You can specify default handler
1111

1212
@Handler<Int>
13-
var handleSumResult // or leave it nil
13+
var handleSumResult // or leave it nil
1414

1515
func sumOf(_ a: Int, _ b: Int) -> Int? {
1616
let result = _sum((a, b))
@@ -25,7 +25,7 @@ final class FunctionalClosuresTests: XCTestCase {
2525
let a = 10
2626
let b = 20
2727
let c = 30
28-
var storageForHandler: Int? = nil
28+
var storageForHandler: Int?
2929

3030
object.handleSumResult { int in
3131
storageForHandler = int
@@ -52,10 +52,10 @@ final class FunctionalClosuresTests: XCTestCase {
5252
func testUsageWithBuilder() {
5353
final class Object: ConfigInitializable {
5454
@DataSource<(Int, Int), Int>
55-
var sum = .init { $0 + $1 } // You can specify default handler
55+
var sum = .init { $0 + $1 } // You can specify default handler
5656

5757
@Handler3<Int, Int, Int>
58-
var handleSum // or leave it nil
58+
var handleSum // or leave it nil
5959

6060
init() {}
6161

0 commit comments

Comments
 (0)