Skip to content

Commit 4f1f96b

Browse files
committed
Merge branch 'release/3.2.1' into versions
2 parents 80a9697 + 7afa2d1 commit 4f1f96b

14 files changed

Lines changed: 766 additions & 96 deletions

File tree

.github/workflows/main.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, versions]
6+
7+
pull_request:
8+
branches: [main]
9+
10+
jobs:
11+
cancel-previous-runs:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Cancel previous runs of this workflow on same branch
16+
uses: rokroskar/workflow-run-cleanup-action@v0.2.2
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
20+
anylint:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
- name: Export latest tool versions
27+
run: |
28+
latest_version() {
29+
curl --silent "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
30+
}
31+
echo "::set-env name=ANYLINT_LATEST_VERSION::$( latest_version Flinesoft/AnyLint )"
32+
echo "::set-env name=SWIFT_SH_LATEST_VERSION::$( latest_version mxcl/swift-sh )"
33+
34+
- name: AnyLint Cache
35+
uses: actions/cache@v1
36+
id: anylint-cache
37+
with:
38+
path: anylint-cache
39+
key: ${{ runner.os }}-v1-anylint-${{ env.ANYLINT_LATEST_VERSION }}-swift-sh-${{ env.SWIFT_SH_LATEST_VERSION }}
40+
41+
- name: Copy from cache
42+
if: steps.anylint-cache.outputs.cache-hit
43+
run: |
44+
sudo cp -f anylint-cache/anylint /usr/local/bin/anylint
45+
sudo cp -f anylint-cache/swift-sh /usr/local/bin/swift-sh
46+
47+
- name: Install AnyLint
48+
if: steps.anylint-cache.outputs.cache-hit != 'true'
49+
run: |
50+
git clone https://github.com/Flinesoft/AnyLint.git
51+
cd AnyLint
52+
swift build -c release
53+
sudo cp -f .build/release/anylint /usr/local/bin/anylint
54+
55+
- name: Install swift-sh
56+
if: steps.anylint-cache.outputs.cache-hit != 'true'
57+
run: |
58+
git clone https://github.com/mxcl/swift-sh.git
59+
cd swift-sh
60+
swift build -c release
61+
sudo cp -f .build/release/swift-sh /usr/local/bin/swift-sh
62+
63+
- name: Copy to cache
64+
if: steps.anylint-cache.outputs.cache-hit != 'true'
65+
run: |
66+
mkdir -p anylint-cache
67+
cp -f /usr/local/bin/anylint anylint-cache/anylint
68+
cp -f /usr/local/bin/swift-sh anylint-cache/swift-sh
69+
70+
- name: Cleanup checkouts
71+
run: rm -rf AnyLint && rm -rf swift-sh
72+
73+
- name: Run AnyLint
74+
run: anylint
75+
76+
swiftlint:
77+
runs-on: ubuntu-latest
78+
79+
steps:
80+
- uses: actions/checkout@v2
81+
82+
- name: Run SwiftLint
83+
uses: norio-nomura/action-swiftlint@3.1.0
84+
with:
85+
args: --strict
86+
87+
test-linux:
88+
runs-on: ubuntu-latest
89+
90+
steps:
91+
- uses: actions/checkout@v2
92+
93+
- name: Run tests
94+
run: swift test -v
95+
96+
test-macos:
97+
runs-on: macOS-latest
98+
99+
steps:
100+
- uses: actions/checkout@v2
101+
102+
- name: Run tests
103+
run: swift test -v --enable-code-coverage
104+
105+
- name: Export coverage Data
106+
run: xcrun llvm-cov export -format="lcov" .build/debug/${{ env.PACKAGE_NAME }}PackageTests.xctest/Contents/MacOS/${{ env.PACKAGE_NAME }}PackageTests -instr-profile .build/debug/codecov/default.profdata > coverage.lcov
107+
env:
108+
PACKAGE_NAME: HandySwift
109+
110+
- name: Upload Coverage to Codecov
111+
uses: codecov/codecov-action@v1.0.7
112+
with:
113+
token: ${{ secrets.CODECOV_TOKEN }}

CHANGELOG.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se
3131
### Security
3232
- None.
3333

34+
## [3.2.1] - 2020-10-03
35+
### Changed
36+
- `Withable` doesn't require an empty `init()` method anymore. Instead, it can be combined with any initializer. If you used the `Foo { $0.bar = 5 }` type of initializer, you will need to add `().with` behind the type like so: `Foo().with { $0.bar = 5 }`.
37+
Issue: [#49](https://github.com/Flinesoft/HandySwift/issues/49) | PR: [#50](https://github.com/Flinesoft/HandySwift/pull/50) | Author: [Cihat Gündüz](https://github.com/Jeehut)
38+
- Improved with new `removeAll` method, conformance to `BidirectionalCollection`, `ExpressibleByArrayLiteral` and removal of `newElement` label on `insert.
39+
Author: [Cihat Gündüz](https://github.com/Jeehut)
40+
### Fixed
41+
- Made all functions accept throwing closures to allow wider usage cases for helper functions like `.times` etc.
42+
Author: [Cihat Gündüz](https://github.com/Jeehut)
43+
3444
## [3.2.0] - 2020-03-27
3545
### Added
3646
- New `DivisibleArithmetic` protocol which easily extends `average()` to Collections of `Double`, `Float` and `CGFloat`.
@@ -43,31 +53,31 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se
4353

4454
## [3.1.0] - 2019-09-01
4555
### Added
46-
- New `Comparable.clamped(to:)` and `Comparable.clamp(to:)` interfaces for any `Comparable`, e. g. `Int`.
47-
56+
- New `Comparable.clamped(to:)` and `Comparable.clamp(to:)` interfaces for any `Comparable`, e. g. `Int`.
57+
4858
## [3.0.0] - 2019-04-30
4959
### Added
50-
- New `Withable` protocol to init/copy objects and set properties in a convenient way on a single line.
60+
- New `Withable` protocol to init/copy objects and set properties in a convenient way on a single line.
5161
### Changed
52-
- Upgraded to Swift 5 & Xcode 10.2.
62+
- Upgraded to Swift 5 & Xcode 10.2.
5363
### Removed
54-
- Remove `ExpressibleByStringLiteral` conformance of `Regex` type to only allow initialization via `init(_:options:) throws` interface.
55-
64+
- Remove `ExpressibleByStringLiteral` conformance of `Regex` type to only allow initialization via `init(_:options:) throws` interface.
65+
5666
## [2.8.0] - 2019-02-11
5767
### Added
58-
- New `NSRange(_:in:)` initializer for converting from `Range<String.Index>`
59-
- New `sum` computed property on `Sequence` types like `Array`
60-
- New `average` computed property on `Collection` types with `Int` or `Double` elements like `[Int]`
61-
- New `fullRange` and `fullNSRange` computed properties on `String`
68+
- New `NSRange(_:in:)` initializer for converting from `Range<String.Index>`
69+
- New `sum` computed property on `Sequence` types like `Array`
70+
- New `average` computed property on `Collection` types with `Int` or `Double` elements like `[Int]`
71+
- New `fullRange` and `fullNSRange` computed properties on `String`
6272
### Changed
63-
- Made some APIs available in wider contexts (like `sample` in `RandomAccessCollection` instead of `Array`)
64-
73+
- Made some APIs available in wider contexts (like `sample` in `RandomAccessCollection` instead of `Array`)
74+
6575
## [2.7.0] - 2018-09-27
6676
### Added
67-
- Official support for Linux & Swift Package Manager.
77+
- Official support for Linux & Swift Package Manager.
6878
### Removed
69-
- Support for Swift 4.1 and lower was dropped.
70-
79+
- Support for Swift 4.1 and lower was dropped.
80+
7181
## [2.6.0] - 2018-04-22
7282
### Added
73-
- New swifty `Regex` type built on top of the NSRegularExpression API.
83+
- New swifty `Regex` type built on top of the NSRegularExpression API.

HandySwift.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = "HandySwift"
4-
s.version = "3.2.0"
4+
s.version = "3.2.1"
55
s.summary = "Handy Swift features that didn't make it into the Swift standard library"
66

77
s.description = <<-DESC

HandySwift.xcodeproj/project.pbxproj

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
2E18B296242DF436000C7776 /* NSObjectExtTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E18B295242DF436000C7776 /* NSObjectExtTests.swift */; };
1414
2E18B297242DF436000C7776 /* NSObjectExtTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E18B295242DF436000C7776 /* NSObjectExtTests.swift */; };
1515
2E18B298242DF436000C7776 /* NSObjectExtTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E18B295242DF436000C7776 /* NSObjectExtTests.swift */; };
16+
2E61DF7A249E1CA9000AF3C5 /* Withable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E61DF79249E1CA9000AF3C5 /* Withable.swift */; };
17+
2E61DF7B249E1CA9000AF3C5 /* Withable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E61DF79249E1CA9000AF3C5 /* Withable.swift */; };
18+
2E61DF7C249E1CA9000AF3C5 /* Withable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E61DF79249E1CA9000AF3C5 /* Withable.swift */; };
19+
2E61DF7E249E1D37000AF3C5 /* WithableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E61DF7D249E1D37000AF3C5 /* WithableTests.swift */; };
20+
2E61DF7F249E1D37000AF3C5 /* WithableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E61DF7D249E1D37000AF3C5 /* WithableTests.swift */; };
21+
2E61DF80249E1D37000AF3C5 /* WithableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E61DF7D249E1D37000AF3C5 /* WithableTests.swift */; };
1622
3F95C8D220F22A3C0045AFD0 /* CollectionExt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F95C8D120F22A3C0045AFD0 /* CollectionExt.swift */; };
1723
3F95C8D520F22DEE0045AFD0 /* CollectionExtTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F95C8D320F22DC60045AFD0 /* CollectionExtTests.swift */; };
1824
3F95C8D620F22DEF0045AFD0 /* CollectionExtTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F95C8D320F22DC60045AFD0 /* CollectionExtTests.swift */; };
@@ -30,12 +36,6 @@
3036
823B2B3C1C24AAB7007B3CDD /* HandySwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 823B2B311C24AAB6007B3CDD /* HandySwift.framework */; };
3137
823B2B4D1C24ABA4007B3CDD /* IntExt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 823B2B4C1C24ABA4007B3CDD /* IntExt.swift */; };
3238
823B2B501C24AC00007B3CDD /* IntExtTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 823B2B4F1C24AC00007B3CDD /* IntExtTests.swift */; };
33-
8251AA2022786D460022B277 /* Withable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8251AA1F22786D460022B277 /* Withable.swift */; };
34-
8251AA2122786D460022B277 /* Withable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8251AA1F22786D460022B277 /* Withable.swift */; };
35-
8251AA2222786D460022B277 /* Withable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8251AA1F22786D460022B277 /* Withable.swift */; };
36-
8251AA25227875C00022B277 /* WithableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8251AA24227875C00022B277 /* WithableTests.swift */; };
37-
8251AA26227875C00022B277 /* WithableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8251AA24227875C00022B277 /* WithableTests.swift */; };
38-
8251AA27227875C00022B277 /* WithableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8251AA24227875C00022B277 /* WithableTests.swift */; };
3939
8258E4561C2E0C140031CBFF /* SortedArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8258E4551C2E0C140031CBFF /* SortedArray.swift */; };
4040
8258E4591C2E1ACE0031CBFF /* SortedArrayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8258E4581C2E1ACE0031CBFF /* SortedArrayTests.swift */; };
4141
825EFDD41C3333B000558497 /* HandySwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 825EFDCA1C3333B000558497 /* HandySwift.framework */; };
@@ -142,6 +142,8 @@
142142
2E18B291242DECCA000C7776 /* NSObjectExt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSObjectExt.swift; sourceTree = "<group>"; };
143143
2E18B295242DF436000C7776 /* NSObjectExtTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSObjectExtTests.swift; sourceTree = "<group>"; };
144144
2E4189DB231B971E00C65B81 /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitignore; sourceTree = "<group>"; };
145+
2E61DF79249E1CA9000AF3C5 /* Withable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Withable.swift; sourceTree = "<group>"; };
146+
2E61DF7D249E1D37000AF3C5 /* WithableTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WithableTests.swift; sourceTree = "<group>"; };
145147
3F95C8D120F22A3C0045AFD0 /* CollectionExt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionExt.swift; sourceTree = "<group>"; };
146148
3F95C8D320F22DC60045AFD0 /* CollectionExtTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionExtTests.swift; sourceTree = "<group>"; };
147149
63651F8F231BFF2000E022DA /* DivisibleArithmetic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DivisibleArithmetic.swift; sourceTree = "<group>"; };
@@ -157,8 +159,6 @@
157159
823B2B421C24AAB7007B3CDD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
158160
823B2B4C1C24ABA4007B3CDD /* IntExt.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntExt.swift; sourceTree = "<group>"; };
159161
823B2B4F1C24AC00007B3CDD /* IntExtTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntExtTests.swift; sourceTree = "<group>"; };
160-
8251AA1F22786D460022B277 /* Withable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Withable.swift; sourceTree = "<group>"; };
161-
8251AA24227875C00022B277 /* WithableTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WithableTests.swift; sourceTree = "<group>"; };
162162
8258E4551C2E0C140031CBFF /* SortedArray.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SortedArray.swift; sourceTree = "<group>"; };
163163
8258E4581C2E1ACE0031CBFF /* SortedArrayTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SortedArrayTests.swift; sourceTree = "<group>"; };
164164
825EFDCA1C3333B000558497 /* HandySwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = HandySwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -325,15 +325,15 @@
325325
isa = PBXGroup;
326326
children = (
327327
63651F8F231BFF2000E022DA /* DivisibleArithmetic.swift */,
328-
8251AA1F22786D460022B277 /* Withable.swift */,
328+
2E61DF79249E1CA9000AF3C5 /* Withable.swift */,
329329
);
330330
path = Protocols;
331331
sourceTree = "<group>";
332332
};
333333
8251AA23227875A10022B277 /* Protocols */ = {
334334
isa = PBXGroup;
335335
children = (
336-
8251AA24227875C00022B277 /* WithableTests.swift */,
336+
2E61DF7D249E1D37000AF3C5 /* WithableTests.swift */,
337337
);
338338
path = Protocols;
339339
sourceTree = "<group>";
@@ -774,9 +774,9 @@
774774
823B2B4D1C24ABA4007B3CDD /* IntExt.swift in Sources */,
775775
CC66E047228199A0007ABF61 /* ComparableExt.swift in Sources */,
776776
C5C89B9420B0A0C10048B07C /* Weak.swift in Sources */,
777-
8251AA2022786D460022B277 /* Withable.swift in Sources */,
778777
82CAE2921C2ED1A200F934A7 /* StringExt.swift in Sources */,
779778
82CAE2961C2EE64900F934A7 /* ArrayExt.swift in Sources */,
779+
2E61DF7A249E1CA9000AF3C5 /* Withable.swift in Sources */,
780780
C5CFB6AC20B0A70300830511 /* Unowned.swift in Sources */,
781781
82812A9B1D06877B00CD5B6C /* Globals.swift in Sources */,
782782
63651F90231BFF2000E022DA /* DivisibleArithmetic.swift in Sources */,
@@ -792,8 +792,8 @@
792792
826F69B01C389DB800B2CC6B /* FrequencyTableTests.swift in Sources */,
793793
827599641E520FB800787F99 /* DispatchTimeIntervalExtTests.swift in Sources */,
794794
8258E4591C2E1ACE0031CBFF /* SortedArrayTests.swift in Sources */,
795+
2E61DF7E249E1D37000AF3C5 /* WithableTests.swift in Sources */,
795796
A11830D71E58A11D00CBE087 /* TimeIntervalExtTests.swift in Sources */,
796-
8251AA25227875C00022B277 /* WithableTests.swift in Sources */,
797797
823B2B501C24AC00007B3CDD /* IntExtTests.swift in Sources */,
798798
82CAE2941C2ED5E000F934A7 /* StringExtTests.swift in Sources */,
799799
82CAE2981C2EE95200F934A7 /* ArrayExtTests.swift in Sources */,
@@ -821,9 +821,9 @@
821821
82E21E8E211AF9960061EB1B /* CollectionExt.swift in Sources */,
822822
CC66E048228199DE007ABF61 /* ComparableExt.swift in Sources */,
823823
C5CFB6AF20B0A78F00830511 /* Weak.swift in Sources */,
824-
8251AA2122786D460022B277 /* Withable.swift in Sources */,
825824
A1F221651E3CC05100419B06 /* DispatchTimeIntervalExt.swift in Sources */,
826825
825EFE021C33358400558497 /* SortedArray.swift in Sources */,
826+
2E61DF7B249E1CA9000AF3C5 /* Withable.swift in Sources */,
827827
825EFE031C33358400558497 /* IntExt.swift in Sources */,
828828
82812A9C1D06877B00CD5B6C /* Globals.swift in Sources */,
829829
63651F91231BFF2000E022DA /* DivisibleArithmetic.swift in Sources */,
@@ -839,8 +839,8 @@
839839
826F69B11C389DB800B2CC6B /* FrequencyTableTests.swift in Sources */,
840840
827599651E520FB800787F99 /* DispatchTimeIntervalExtTests.swift in Sources */,
841841
825EFE111C3335A400558497 /* StringExtTests.swift in Sources */,
842+
2E61DF7F249E1D37000AF3C5 /* WithableTests.swift in Sources */,
842843
A11830D81E58A11D00CBE087 /* TimeIntervalExtTests.swift in Sources */,
843-
8251AA26227875C00022B277 /* WithableTests.swift in Sources */,
844844
825EFE0E1C3335A400558497 /* SortedArrayTests.swift in Sources */,
845845
825EFE121C3335A400558497 /* ArrayExtTests.swift in Sources */,
846846
825EFE0F1C3335A400558497 /* IntExtTests.swift in Sources */,
@@ -868,9 +868,9 @@
868868
82E21E8F211AF9970061EB1B /* CollectionExt.swift in Sources */,
869869
CC66E049228199DF007ABF61 /* ComparableExt.swift in Sources */,
870870
C5CFB6B020B0A79000830511 /* Weak.swift in Sources */,
871-
8251AA2222786D460022B277 /* Withable.swift in Sources */,
872871
A1F221661E3CC05100419B06 /* DispatchTimeIntervalExt.swift in Sources */,
873872
825EFE081C33358500558497 /* SortedArray.swift in Sources */,
873+
2E61DF7C249E1CA9000AF3C5 /* Withable.swift in Sources */,
874874
825EFE091C33358500558497 /* IntExt.swift in Sources */,
875875
82812A9D1D06877B00CD5B6C /* Globals.swift in Sources */,
876876
63651F92231BFF2800E022DA /* DivisibleArithmetic.swift in Sources */,
@@ -886,8 +886,8 @@
886886
826F69B21C389DB800B2CC6B /* FrequencyTableTests.swift in Sources */,
887887
827599661E520FB800787F99 /* DispatchTimeIntervalExtTests.swift in Sources */,
888888
825EFE171C3335A500558497 /* StringExtTests.swift in Sources */,
889+
2E61DF80249E1D37000AF3C5 /* WithableTests.swift in Sources */,
889890
A11830D91E58A11D00CBE087 /* TimeIntervalExtTests.swift in Sources */,
890-
8251AA27227875C00022B277 /* WithableTests.swift in Sources */,
891891
825EFE141C3335A500558497 /* SortedArrayTests.swift in Sources */,
892892
825EFE181C3335A500558497 /* ArrayExtTests.swift in Sources */,
893893
825EFE151C3335A500558497 /* IntExtTests.swift in Sources */,

README.md

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,17 @@
44
</p>
55

66
<p align="center">
7-
<a href="https://app.bitrise.io/app/cbc4cab821708298">
8-
<img src="https://app.bitrise.io/app/cbc4cab821708298/status.svg?token=1fWFE7UCuTBoYTGf4StnFQ&branch=main"
9-
alt="Build Status">
7+
<a href="https://github.com/Flinesoft/HandySwift/actions?query=branch%3Amain">
8+
<img src="https://github.com/Flinesoft/HandySwift/workflows/CI/badge.svg"
9+
alt="CI">
1010
</a>
11-
<a href="https://www.codacy.com/gh/Flinesoft/HandySwift">
12-
<img src="https://api.codacy.com/project/badge/Grade/f15d85eb68244c8f8c35af88ace3cdd0"
13-
alt="Code Quality"/>
14-
</a>
15-
<a href="https://www.codacy.com/gh/Flinesoft/HandySwift">
16-
<img src="https://api.codacy.com/project/badge/Coverage/f15d85eb68244c8f8c35af88ace3cdd0"
11+
<a href="https://codecov.io/gh/Flinesoft/HandySwift">
12+
<img src="https://codecov.io/gh/Flinesoft/HandySwift/branch/main/graph/badge.svg"
1713
alt="Coverage"/>
1814
</a>
1915
<a href="https://github.com/Flinesoft/HandySwift/releases">
20-
<img src="https://img.shields.io/badge/Version-3.2.0-blue.svg"
21-
alt="Version: 3.2.0">
16+
<img src="https://img.shields.io/badge/Version-3.2.1-blue.svg"
17+
alt="Version: 3.2.1">
2218
</a>
2319
<img src="https://img.shields.io/badge/Swift-5.1-FFAC45.svg" alt="Swift: 5.1">
2420
<img src="https://img.shields.io/badge/Platforms-iOS%20%7C%20tvOS%20%7C%20macOS%20%7C%20Linux-FF69B4.svg"
@@ -573,18 +569,15 @@ Simple protocol to make constructing and modifying objects with multiple propert
573569

574570
``` swift
575571
struct Foo: Withable {
576-
var bar: Int = 0
577-
var baz: Bool = false
572+
var bar: Int
573+
var isEasy: Bool = false
578574
}
579575

580-
// Construct a foo, setting an arbitrary subset of properties
581-
let foo = Foo { $0.bar = 5 }
582-
583-
// Make a copy of foo, overriding an arbitrary subset of properties
584-
let foo2 = foo.with { $0.bar = 7; $0.baz = true }
576+
let defaultFoo = Foo(bar: 5)
577+
let customFoo = Foo(bar: 5).with { $0.isEasy = true }
585578

586-
foo.bar // => 5
587-
foo2.bar // => 7
579+
foo.isEasy // => false
580+
foo2.isEasy // => true
588581
```
589582

590583

0 commit comments

Comments
 (0)