Skip to content

Commit b554c1a

Browse files
committed
Drop support for Swift5.0 and Xcode10
1 parent 87d52d0 commit b554c1a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+505
-741
lines changed

.github/workflows/ci.yml

+7-10
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,11 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
xcode_version: [10.2, 11.1]
11-
include:
12-
- xcode_version: 10.2
13-
simulator_name: iPhone SE
14-
ios_version: 10.2
15-
- xcode_version: 11.1
16-
simulator_name: iPhone 11 Pro
17-
ios_version: 13.1
10+
xcode_version:
11+
- 11.1
12+
destination:
13+
- platform=iOS Simulator,name=iPhone 11 Pro,OS=13.1
14+
- platform=iOS Simulator,name=iPhone SE,OS=10.0
1815
env:
1916
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
2017
steps:
@@ -25,6 +22,6 @@ jobs:
2522
run: |
2623
swift --version
2724
xcodebuild -version
28-
- name: Test iOS on Xcode ${{ matrix.xcode_version }}
25+
- name: Test iOS on Xcode ${{ matrix.xcode_version }} simulator ${{ matrix.destination }}
2926
run: |
30-
set -o pipefail && xcodebuild build-for-testing test-without-building -workspace Carbon.xcworkspace -scheme Carbon -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=${{ matrix.simulator_name }},OS=${{ matrix.ios_version }}' ENABLE_TESTABILITY=YES | xcpretty -c
27+
set -o pipefail && xcodebuild build-for-testing test-without-building -workspace Carbon.xcworkspace -scheme Carbon -configuration Release -sdk iphonesimulator -destination '${{ matrix.destination }}' ENABLE_TESTABILITY=YES | xcpretty -c

.swift-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.0
1+
5.1

Carbon.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Pod::Spec.new do |spec|
99
spec.source_files = 'Sources/**/*.swift'
1010
spec.license = { :type => 'Apache 2.0', :file => 'LICENSE' }
1111
spec.requires_arc = true
12-
spec.swift_versions = ['5.0', '5.1']
12+
spec.swift_versions = ['5.1']
1313
spec.ios.deployment_target = '10.0'
1414
spec.dependency 'DifferenceKit/Core', "~> 1.1"
1515
spec.ios.frameworks = 'UIKit'

README.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ in UITableView and UICollectionView.</br>
1919
<a href="https://github.com/Carthage/Carthage"><img alt="Carthage" src="https://img.shields.io/badge/carthage-compatible-yellow.svg"/></a>
2020
</br>
2121
<a href="https://github.com/ra1028/Carbon/actions"><img alt="CI Status" src="https://github.com/ra1028/Carbon/workflows/GitHub%20Actions/badge.svg"/></a>
22-
<a href="https://developer.apple.com/swift"><img alt="Swift5" src="https://img.shields.io/badge/language-Swift5-orange.svg"/></a>
22+
<a href="https://developer.apple.com/swift"><img alt="Swift 5.1" src="https://img.shields.io/badge/language-Swift 5.1-orange.svg"/></a>
2323
<a href="https://developer.apple.com/"><img alt="Platform" src="https://img.shields.io/badge/platform-iOS-green.svg"/></a>
2424
<a href="https://github.com/ra1028/Carbon/blob/master/LICENSE"><img alt="Lincense" src="https://img.shields.io/badge/License-Apache%202.0-black.svg"/></a>
2525
</p>
@@ -522,7 +522,7 @@ Default is `true`.
522522

523523
### Without FunctionBuilder Syntax
524524

525-
If you are using Swift 5, you cannot use the function builder that you have queried so far, but Carbon can also build a UI with declarative syntax without function builder as following.
525+
Carbon can also build a UI with declarative syntax without function builder as following.
526526

527527
- **ViewNode**
528528

@@ -567,10 +567,8 @@ renderer.render(
567567

568568
## Requirements
569569

570-
- Swift 5.0+
571-
- Xcode 10.2+
572-
573-
Note: function builder syntax requires Swift5.1+ and Xcode 11.0+
570+
- Swift 5.1+
571+
- Xcode 11.0+
574572

575573
---
576574

@@ -589,7 +587,7 @@ github "ra1028/Carbon"
589587
```
590588

591589
### [Swift Package Manager](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app)
592-
Select Xcode menu File > Swift Packages > Add Package Dependency and enter repository URL with GUI.
590+
Select Xcode menu `File > Swift Packages > Add Package Dependency...` and enter repository URL with GUI.
593591
```
594592
Repository: https://github.com/ra1028/Carbon
595593
```

Sources/ComponentWrapper/ComponentWrapping.swift

-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import UIKit
22

3-
#if swift(>=5.1)
4-
53
/// Represents a wrapper of component that forwards all actions to wrapped component.
64
/// You can easily conform arbitrary type to `Component` protocol by wrapping component instance.
75
@dynamicMemberLookup
@@ -21,20 +19,6 @@ public extension ComponentWrapping {
2119
}
2220
}
2321

24-
#else
25-
26-
/// Represents a wrapper of component that forwards all actions to wrapped component.
27-
/// You can easily conform arbitrary type to `Component` protocol by wrapping component instance.
28-
public protocol ComponentWrapping: Component {
29-
/// The type of wrapped component.
30-
associatedtype Wrapped: Component
31-
32-
/// The wrapped component instance.
33-
var wrapped: Wrapped { get }
34-
}
35-
36-
#endif
37-
3822
public extension ComponentWrapping {
3923
/// A string used to identify a element that is reusable. Default is the type name of `self`.
4024
@inlinable

Sources/FunctionBuilder/CellsBuilder.swift

-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#if swift(>=5.1)
2-
31
// swiftlint:disable line_length
42
// swiftlint:disable function_parameter_count
53

@@ -174,5 +172,3 @@ internal extension CellsBuilder {
174172
cellNodes = cellNodes0 + cellNodes1 + cellNodes2 + c9.buildCells()
175173
}
176174
}
177-
178-
#endif

Sources/FunctionBuilder/Group.swift

-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#if swift(>=5.1)
2-
31
/// An affordance for grouping component or section.
42
///
53
/// Example for simple grouping of cells.
@@ -82,5 +80,3 @@ extension Group: SectionsBuildable where Element == Section {
8280
elements
8381
}
8482
}
85-
86-
#endif

Sources/FunctionBuilder/SectionsBuilder.swift

-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#if swift(>=5.1)
2-
31
// swiftlint:disable line_length
42
// swiftlint:disable function_parameter_count
53

@@ -173,5 +171,3 @@ internal extension SectionsBuilder {
173171
sections = sections0 + sections1 + sections2 + s9.buildSections()
174172
}
175173
}
176-
177-
#endif

Sources/Renderer.swift

-6
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,7 @@ open class Renderer<Updater: Carbon.Updater> {
9393
open func render(_ data: Section?...) {
9494
render(data.compactMap { $0 })
9595
}
96-
}
97-
98-
#if swift(>=5.1)
9996

100-
extension Renderer {
10197
/// Render given variadic number of sections with function builder syntax, immediately.
10298
///
10399
/// - Parameters:
@@ -117,6 +113,4 @@ extension Renderer {
117113
}
118114
}
119115

120-
#endif
121-
122116
private struct UniqueIdentifier: Hashable {}

Sources/Section.swift

+7-13
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,14 @@ public struct Section {
9191
footer: footer
9292
)
9393
}
94-
}
95-
96-
#if swift(>=5.1)
9794

98-
public extension Section {
9995
/// Create a section wrapping given id and cells with function builder syntax.
10096
///
10197
/// - Parameters:
10298
/// - id: An identifier to be wrapped.
10399
/// - cells: A closure that constructs cells.
104100
@inlinable
105-
init<I: Hashable, C: CellsBuildable>(id: I, @CellsBuilder cells: () -> C) {
101+
public init<I: Hashable, C: CellsBuildable>(id: I, @CellsBuilder cells: () -> C) {
106102
self.init(
107103
id: id,
108104
cells: cells().buildCells()
@@ -117,7 +113,7 @@ public extension Section {
117113
/// - footer: A footer component.
118114
/// - cells: A closure that constructs cells.
119115
@inlinable
120-
init<I: Hashable, H: Component, F: Component, C: CellsBuildable>(id: I, header: H?, footer: F?, @CellsBuilder cells: () -> C) {
116+
public init<I: Hashable, H: Component, F: Component, C: CellsBuildable>(id: I, header: H?, footer: F?, @CellsBuilder cells: () -> C) {
121117
self.init(
122118
id: id,
123119
header: header.map(ViewNode.init),
@@ -133,7 +129,7 @@ public extension Section {
133129
/// - header: A header component.
134130
/// - footer: A footer component.
135131
@inlinable
136-
init<I: Hashable, H: Component, F: Component>(id: I, header: H?, footer: F?) {
132+
public init<I: Hashable, H: Component, F: Component>(id: I, header: H?, footer: F?) {
137133
self.init(
138134
id: id,
139135
header: header.map(ViewNode.init),
@@ -148,7 +144,7 @@ public extension Section {
148144
/// - header: A header component.
149145
/// - cells: A closure that constructs cells.
150146
@inlinable
151-
init<I: Hashable, H: Component>(id: I, header: H?, @CellsBuilder cells: () -> CellsBuildable) {
147+
public init<I: Hashable, H: Component>(id: I, header: H?, @CellsBuilder cells: () -> CellsBuildable) {
152148
self.init(
153149
id: id,
154150
header: header.map(ViewNode.init),
@@ -163,7 +159,7 @@ public extension Section {
163159
/// - footer: A footer component.
164160
/// - cells: A closure that constructs cells.
165161
@inlinable
166-
init<I: Hashable, F: Component, C: CellsBuildable>(id: I, footer: F?, @CellsBuilder cells: () -> C) {
162+
public init<I: Hashable, F: Component, C: CellsBuildable>(id: I, footer: F?, @CellsBuilder cells: () -> C) {
167163
self.init(
168164
id: id,
169165
cells: cells().buildCells(),
@@ -177,7 +173,7 @@ public extension Section {
177173
/// - id: An identifier to be wrapped.
178174
/// - header: A header component.
179175
@inlinable
180-
init<I: Hashable, H: Component>(id: I, header: H?) {
176+
public init<I: Hashable, H: Component>(id: I, header: H?) {
181177
self.init(
182178
id: id,
183179
header: header.map(ViewNode.init)
@@ -190,16 +186,14 @@ public extension Section {
190186
/// - id: An identifier to be wrapped.
191187
/// - footer: A footer component.
192188
@inlinable
193-
init<I: Hashable, F: Component>(id: I, footer: F?) {
189+
public init<I: Hashable, F: Component>(id: I, footer: F?) {
194190
self.init(
195191
id: id,
196192
footer: footer.map(ViewNode.init)
197193
)
198194
}
199195
}
200196

201-
#endif
202-
203197
extension Section: SectionsBuildable {
204198
/// Build an array of section.
205199
public func buildSections() -> [Section] {

Tests/FunctionBuilder/CellsBuilderTests.swift

-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#if swift(>=5.1)
2-
31
import XCTest
42
@testable import Carbon
53

@@ -257,5 +255,3 @@ final class CellsBuilderTests: XCTestCase {
257255
}
258256
}
259257
}
260-
261-
#endif

Tests/FunctionBuilder/GroupTests.swift

-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#if swift(>=5.1)
2-
31
import XCTest
42
@testable import Carbon
53

@@ -93,5 +91,3 @@ final class GroupTests: XCTestCase {
9391
XCTAssertEqual(sections[2].id, 2)
9492
}
9593
}
96-
97-
#endif

Tests/FunctionBuilder/SectionsBuilderTests.swift

-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#if swift(>=5.1)
2-
31
import XCTest
42
@testable import Carbon
53

@@ -257,5 +255,3 @@ final class SectionsBuilderTests: XCTestCase {
257255
}
258256
}
259257
}
260-
261-
#endif

Tests/RendererTests.swift

-6
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,7 @@ final class RendererTests: XCTestCase {
155155
XCTAssertEqual(renderer.updater.targetCapturedOnUpdates, target)
156156
XCTAssertEqual(renderer.updater.adapterCapturedOnUpdates, adapter)
157157
}
158-
}
159-
160-
#if swift(>=5.1)
161158

162-
extension RendererTests {
163159
func testRenderWithSectionsBuilder() {
164160
let target = MockTarget()
165161
let adapter = MockAdapter()
@@ -235,5 +231,3 @@ extension RendererTests {
235231
XCTAssertEqual(renderer.updater.adapterCapturedOnUpdates, adapter)
236232
}
237233
}
238-
239-
#endif

Tests/SectionTests.swift

-6
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,7 @@ final class SectionTests: XCTestCase {
144144
let section2 = Section(id: AnyHashable(TestID.b), cells: [dummyNode, nil])
145145
XCTAssertEqual(section2.id, TestID.b)
146146
}
147-
}
148-
149-
#if swift(>=5.1)
150147

151-
extension SectionTests {
152148
func testInitWithCellsBuilder() {
153149
let condition = false
154150
let section = Section(
@@ -181,5 +177,3 @@ extension SectionTests {
181177
XCTAssertEqual(section.cells[4].component(as: B.Component.self)?.value, 200)
182178
}
183179
}
184-
185-
#endif

XCConfigs/Carbon.xcconfig

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ SUPPORTED_PLATFORMS = iphoneos iphonesimulator
55
TARGETED_DEVICE_FAMILY = 1,2
66
VALID_ARCHS[sdk=iphoneos*] = arm64 armv7 armv7s
77
VALID_ARCHS[sdk=iphonesimulator*] = i386 x86_64
8-
OTHER_LDFLAGS[sdk=iphoneos13.0] = -weak_framework SwiftUI
9-
OTHER_LDFLAGS[sdk=iphonesimulator13.0] = -weak_framework SwiftUI
8+
OTHER_LDFLAGS = -weak_framework SwiftUI
109

1110
CODE_SIGNING_REQUIRED = NO
1211
CODE_SIGN_IDENTITY =

docs/Adapter.html

-3
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@
7979
<li class="nav-group-task">
8080
<a class="nav-group-task-link" href="Protocols/ComponentWrapping.html">ComponentWrapping</a>
8181
</li>
82-
<li class="nav-group-task">
83-
<a class="nav-group-task-link" href="Protocols/ComponentWrapping.html">ComponentWrapping</a>
84-
</li>
8582
</ul>
8683
</li>
8784
<li class="nav-group-name">

docs/Builder.html

-3
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@
7979
<li class="nav-group-task">
8080
<a class="nav-group-task-link" href="Protocols/ComponentWrapping.html">ComponentWrapping</a>
8181
</li>
82-
<li class="nav-group-task">
83-
<a class="nav-group-task-link" href="Protocols/ComponentWrapping.html">ComponentWrapping</a>
84-
</li>
8582
</ul>
8683
</li>
8784
<li class="nav-group-name">

docs/Changeset.html

-3
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@
7979
<li class="nav-group-task">
8080
<a class="nav-group-task-link" href="Protocols/ComponentWrapping.html">ComponentWrapping</a>
8181
</li>
82-
<li class="nav-group-task">
83-
<a class="nav-group-task-link" href="Protocols/ComponentWrapping.html">ComponentWrapping</a>
84-
</li>
8582
</ul>
8683
</li>
8784
<li class="nav-group-name">

docs/Classes/Renderer.html

-7
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@
7979
<li class="nav-group-task">
8080
<a class="nav-group-task-link" href="../Protocols/ComponentWrapping.html">ComponentWrapping</a>
8181
</li>
82-
<li class="nav-group-task">
83-
<a class="nav-group-task-link" href="../Protocols/ComponentWrapping.html">ComponentWrapping</a>
84-
</li>
8582
</ul>
8683
</li>
8784
<li class="nav-group-name">
@@ -577,10 +574,6 @@ <h4>Parameters</h4>
577574
</section>
578575
</div>
579576
</li>
580-
</ul>
581-
</div>
582-
<div class="task-group">
583-
<ul class="item-container">
584577
<li class="item">
585578
<div>
586579
<code>

docs/Classes/UICollectionComponentReusableView.html

-3
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@
7979
<li class="nav-group-task">
8080
<a class="nav-group-task-link" href="../Protocols/ComponentWrapping.html">ComponentWrapping</a>
8181
</li>
82-
<li class="nav-group-task">
83-
<a class="nav-group-task-link" href="../Protocols/ComponentWrapping.html">ComponentWrapping</a>
84-
</li>
8582
</ul>
8683
</li>
8784
<li class="nav-group-name">

0 commit comments

Comments
 (0)