Skip to content

Commit 14185d6

Browse files
authored
Merge pull request #177 from 0xLeif/develop
Release 3.0.0
2 parents b21d725 + 6a20875 commit 14185d6

File tree

87 files changed

+3858
-887
lines changed

Some content is hidden

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

87 files changed

+3858
-887
lines changed

.github/workflows/swift.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ jobs:
88
runs-on: macOS-latest
99
strategy:
1010
matrix:
11-
destination: ['platform=iOS Simulator,OS=13.1,name=iPhone 8']
12-
xcode: ['/Applications/Xcode_11.6.app/Contents/Developer']
11+
destination: ['platform=iOS Simulator,OS=13.1,name=iPhone 11']
12+
xcode: ['/Applications/Xcode_12.app/Contents/Developer']
1313
steps:
1414
- uses: actions/checkout@v1
1515
# Github Actions' machines do in fact have recent versions of Xcode,
1616
# but you may have to explicitly switch to them. We explicitly want
17-
# to use Xcode 11, so we use xcode-select to switch to it.
18-
- name: Switch to Xcode 11
19-
run: sudo xcode-select --switch /Applications/Xcode_11.6.app
17+
# to use Xcode 12, so we use xcode-select to switch to it.
18+
- name: Switch to Xcode 12
19+
run: sudo xcode-select --switch /Applications/Xcode_12.app
2020
# Since we want to be running our tests from Xcode, we need to
2121
# generate an .xcodeproj file. Luckly, Swift Package Manager has
2222
# build in functionality to do so.

Package.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ let package = Package(
1414
dependencies: [
1515
// Dependencies declare other packages that this package depends on.
1616
// .package(url: /* package url */, from: "1.0.0"),
17-
.package(url: "https://github.com/0xLeif/Later", from: "0.3.1")
17+
.package(url: "https://github.com/0xLeif/Observation", from: "0.0.2"),
18+
.package(url: "https://github.com/0xLeif/DataObject", from: "0.2.1")
1819
],
1920
targets: [
2021
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
2122
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
2223
.target(
2324
name: "SwiftUIKit",
2425
dependencies: [
25-
"Later"
26+
"Observation",
27+
"DataObject"
2628
]),
2729
.testTarget(
2830
name: "SwiftUIKitTests",

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
UIKit code that is fun to write.
55

6+
## [Documentation](documentation/Home.md) (WIP)
7+
8+
69
## Example Code
710
```Swift
811
import UIKit
@@ -38,7 +41,7 @@ class ViewController: UIViewController {
3841

3942
Spacer(),
4043

41-
Field(value: "SwiftUIKit",
44+
TextField(value: "SwiftUIKit",
4245
placeholder: "Some Name",
4346
keyboardType: .default)
4447
.inputHandler { print("New Name: \($0)") }

Sources/SwiftUIKit/Containers/HScroll.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import UIKit
1010
@available(iOS 9.0, *)
1111
public class HScroll: UIView {
1212

13-
public init(withPadding padding: Float = 0,
14-
_ closure: () -> UIView) {
13+
public init(
14+
withPadding padding: Float = 0,
15+
_ closure: () -> UIView
16+
) {
1517
super.init(frame: .zero)
1618

1719
let scrollableView = closure()

Sources/SwiftUIKit/Containers/HStack.swift

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ public class HStack: UIView {
2424
/// - alignment: The layout of arranged views perpendicular to the stack view’s axis (source: UIStackView.Alignment)
2525
/// - distribution: The layout that defines the size and position of the arranged views along the stack view’s axis (source: UIStackView.Distribution)
2626
/// - closure: A trailing closure that accepts an array of views
27-
public init(withSpacing spacing: Float = 0,
28-
padding: Float = 0,
29-
alignment: UIStackView.Alignment = .fill,
30-
distribution: UIStackView.Distribution = .fill,
31-
_ closure: () -> [UIView]) {
27+
public init(
28+
withSpacing spacing: Float = 0,
29+
padding: Float = 0,
30+
alignment: UIStackView.Alignment = .fill,
31+
distribution: UIStackView.Distribution = .fill,
32+
_ closure: () -> [UIView]
33+
) {
3234
self.spacing = spacing
3335
self.padding = padding
3436
self.alignment = alignment
@@ -45,11 +47,13 @@ public class HStack: UIView {
4547
/// - alignment: The layout of arranged views perpendicular to the stack view’s axis (source: UIStackView.Alignment)
4648
/// - distribution: The layout that defines the size and position of the arranged views along the stack view’s axis (source: UIStackView.Distribution)
4749
/// - closure: A trailing closure that accepts an array of optional views
48-
public init(withSpacing spacing: Float = 0,
49-
padding: Float = 0,
50-
alignment: UIStackView.Alignment = .fill,
51-
distribution: UIStackView.Distribution = .fill,
52-
_ closure: () -> [UIView?]) {
50+
public init(
51+
withSpacing spacing: Float = 0,
52+
padding: Float = 0,
53+
alignment: UIStackView.Alignment = .fill,
54+
distribution: UIStackView.Distribution = .fill,
55+
_ closure: () -> [UIView?]
56+
) {
5357
self.spacing = spacing
5458
self.padding = padding
5559
self.alignment = alignment
@@ -70,7 +74,7 @@ public class HStack: UIView {
7074
padding: padding,
7175
alignment: alignment,
7276
distribution: distribution)
73-
{ views }
77+
{ views }
7478
}
7579

7680
public func update(views closure: (inout [UIView]) -> Void) -> Self {

Sources/SwiftUIKit/Containers/VScroll.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import UIKit
1010
@available(iOS 9.0, *)
1111
public class VScroll: UIView {
1212

13-
public init(withPadding padding: Float = 0,
14-
_ closure: () -> UIView) {
13+
public init(
14+
withPadding padding: Float = 0,
15+
_ closure: () -> UIView
16+
) {
1517
super.init(frame: .zero)
1618

1719
let scrollableView = closure()

Sources/SwiftUIKit/Containers/VStack.swift

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
//
77

88
import UIKit
9-
import Later
109

1110
/// Vertical StackView
1211
@available(iOS 9.0, *)
@@ -25,11 +24,13 @@ public class VStack: UIView {
2524
/// - alignment: The layout of arranged views perpendicular to the stack view’s axis (source: UIStackView.Alignment)
2625
/// - distribution: The layout that defines the size and position of the arranged views along the stack view’s axis (source: UIStackView.Distribution)
2726
/// - closure: A trailing closure that accepts an array of views
28-
public init(withSpacing spacing: Float = 0,
29-
padding: Float = 0,
30-
alignment: UIStackView.Alignment = .fill,
31-
distribution: UIStackView.Distribution = .fill,
32-
_ closure: () -> [UIView]) {
27+
public init(
28+
withSpacing spacing: Float = 0,
29+
padding: Float = 0,
30+
alignment: UIStackView.Alignment = .fill,
31+
distribution: UIStackView.Distribution = .fill,
32+
_ closure: () -> [UIView]
33+
) {
3334
self.spacing = spacing
3435
self.padding = padding
3536
self.alignment = alignment
@@ -46,11 +47,13 @@ public class VStack: UIView {
4647
/// - alignment: The layout of arranged views perpendicular to the stack view’s axis (source: UIStackView.Alignment)
4748
/// - distribution: The layout that defines the size and position of the arranged views along the stack view’s axis (source: UIStackView.Distribution)
4849
/// - closure: A trailing closure that accepts an array of optional views
49-
public init(withSpacing spacing: Float = 0,
50-
padding: Float = 0,
51-
alignment: UIStackView.Alignment = .fill,
52-
distribution: UIStackView.Distribution = .fill,
53-
_ closure: () -> [UIView?]) {
50+
public init(
51+
withSpacing spacing: Float = 0,
52+
padding: Float = 0,
53+
alignment: UIStackView.Alignment = .fill,
54+
distribution: UIStackView.Distribution = .fill,
55+
_ closure: () -> [UIView?]
56+
) {
5457
self.spacing = spacing
5558
self.padding = padding
5659
self.alignment = alignment
@@ -71,7 +74,7 @@ public class VStack: UIView {
7174
padding: padding,
7275
alignment: alignment,
7376
distribution: distribution)
74-
{ views }
77+
{ views }
7578
}
7679

7780
@discardableResult

Sources/SwiftUIKit/Extensions/NSLayoutConstraint+SwiftUIKit.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,18 @@ public extension UIView {
4646
constraint.isConnected(toAnchor: bottomAnchor)
4747
}
4848
}
49+
50+
/// The height constraints held by the view
51+
var heightConstraints: [NSLayoutConstraint] {
52+
constraints.filter { (constraint) -> Bool in
53+
constraint.isConnected(toAnchor: heightAnchor)
54+
}
55+
}
56+
57+
/// The width constraints held by the view
58+
var widthConstraints: [NSLayoutConstraint] {
59+
constraints.filter { (constraint) -> Bool in
60+
constraint.isConnected(toAnchor: widthAnchor)
61+
}
62+
}
4963
}

Sources/SwiftUIKit/Extensions/NSObjectProtocol+SwiftUIKit.swift

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//
2+
// SwiftFu+.swift
3+
//
4+
//
5+
// Created by Leif on 3/16/21.
6+
//
7+
8+
import SwiftFu

0 commit comments

Comments
 (0)