Skip to content

Commit 41c0c7d

Browse files
committed
Update README and documents
1 parent d0f888a commit 41c0c7d

22 files changed

+193
-324
lines changed

Demo/Demo.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/* Begin PBXBuildFile section */
1010
080677C628BE7D8B00000E16 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 080677C528BE7D8B00000E16 /* ViewController.swift */; };
1111
080677C828BE7DA400000E16 /* WrapStackDemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 080677C728BE7DA400000E16 /* WrapStackDemoViewController.swift */; };
12+
0815C093292A2B37001655C6 /* Preview1ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0815C092292A2B37001655C6 /* Preview1ViewController.swift */; };
1213
08A24B8428E49A9600CDD7E2 /* LookinServer in Frameworks */ = {isa = PBXBuildFile; productRef = 08A24B8328E49A9600CDD7E2 /* LookinServer */; };
1314
08E16CD9289ABA1C0019D7CB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E16CD8289ABA1C0019D7CB /* AppDelegate.swift */; };
1415
08E16CDB289ABA1C0019D7CB /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E16CDA289ABA1C0019D7CB /* SceneDelegate.swift */; };
@@ -23,6 +24,7 @@
2324
/* Begin PBXFileReference section */
2425
080677C528BE7D8B00000E16 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
2526
080677C728BE7DA400000E16 /* WrapStackDemoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WrapStackDemoViewController.swift; sourceTree = "<group>"; };
27+
0815C092292A2B37001655C6 /* Preview1ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preview1ViewController.swift; sourceTree = "<group>"; };
2628
08E16CD5289ABA1C0019D7CB /* Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Demo.app; sourceTree = BUILT_PRODUCTS_DIR; };
2729
08E16CD8289ABA1C0019D7CB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
2830
08E16CDA289ABA1C0019D7CB /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
@@ -78,6 +80,7 @@
7880
08E16CE1289ABA1D0019D7CB /* Assets.xcassets */,
7981
08E16CE3289ABA1D0019D7CB /* LaunchScreen.storyboard */,
8082
08E16CE6289ABA1D0019D7CB /* Info.plist */,
83+
0815C092292A2B37001655C6 /* Preview1ViewController.swift */,
8184
);
8285
path = Demo;
8386
sourceTree = "<group>";
@@ -178,6 +181,7 @@
178181
buildActionMask = 2147483647;
179182
files = (
180183
080677C628BE7D8B00000E16 /* ViewController.swift in Sources */,
184+
0815C093292A2B37001655C6 /* Preview1ViewController.swift in Sources */,
181185
08E16CDD289ABA1C0019D7CB /* HVStackDemoViewController.swift in Sources */,
182186
080677C828BE7DA400000E16 /* WrapStackDemoViewController.swift in Sources */,
183187
08E16CD9289ABA1C0019D7CB /* AppDelegate.swift in Sources */,

Demo/Demo/Base.lproj/Main.storyboard

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="9VV-h8-9cl">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="9VV-h8-9cl">
33
<device id="retina6_1" orientation="portrait" appearance="light"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
77
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
88
<capability name="System colors in document resources" minToolsVersion="11.0"/>
99
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -18,18 +18,26 @@
1818
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1919
<subviews>
2020
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="21" translatesAutoresizingMaskIntoConstraints="NO" id="M84-Lf-Gfo">
21-
<rect key="frame" x="135" y="403" width="144" height="90"/>
21+
<rect key="frame" x="135" y="375.5" width="144" height="145.5"/>
2222
<subviews>
23-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="06f-Ws-ezl">
23+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7Tv-fS-6AC">
2424
<rect key="frame" x="0.0" y="0.0" width="144" height="34.5"/>
2525
<state key="normal" title="Button"/>
26+
<buttonConfiguration key="configuration" style="filled" title="Preview 1"/>
27+
<connections>
28+
<segue destination="tKx-sr-SVC" kind="show" id="uEI-YO-OWR"/>
29+
</connections>
30+
</button>
31+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="06f-Ws-ezl">
32+
<rect key="frame" x="0.0" y="55.5" width="144" height="34.5"/>
33+
<state key="normal" title="Button"/>
2634
<buttonConfiguration key="configuration" style="filled" title="H/VStackView"/>
2735
<connections>
2836
<segue destination="hGA-TO-DpM" kind="show" id="CVz-1t-QBY"/>
2937
</connections>
3038
</button>
3139
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Dpb-UY-wFq">
32-
<rect key="frame" x="0.0" y="55.5" width="144" height="34.5"/>
40+
<rect key="frame" x="0.0" y="111" width="144" height="34.5"/>
3341
<state key="normal" title="Button"/>
3442
<buttonConfiguration key="configuration" style="filled" title="WrapStackView"/>
3543
<connections>
@@ -52,6 +60,22 @@
5260
</objects>
5361
<point key="canvasLocation" x="1047.8260869565217" y="122.54464285714285"/>
5462
</scene>
63+
<!--Preview 1-->
64+
<scene sceneID="WWL-j7-G0R">
65+
<objects>
66+
<viewController id="tKx-sr-SVC" customClass="Preview1ViewController" customModule="Demo" customModuleProvider="target" sceneMemberID="viewController">
67+
<view key="view" contentMode="scaleToFill" id="mix-WO-FU6">
68+
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
69+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
70+
<viewLayoutGuide key="safeArea" id="T07-VB-rLL"/>
71+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
72+
</view>
73+
<navigationItem key="navigationItem" title="Preview 1" id="QKw-Hm-q2K"/>
74+
</viewController>
75+
<placeholder placeholderIdentifier="IBFirstResponder" id="NVa-Eg-Ijb" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
76+
</objects>
77+
<point key="canvasLocation" x="3648" y="-550"/>
78+
</scene>
5579
<!--H/VStackView-->
5680
<scene sceneID="Lai-fH-3ho">
5781
<objects>
@@ -66,7 +90,7 @@
6690
</viewController>
6791
<placeholder placeholderIdentifier="IBFirstResponder" id="Aln-yL-DfB" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
6892
</objects>
69-
<point key="canvasLocation" x="2077" y="-122"/>
93+
<point key="canvasLocation" x="3648" y="123"/>
7094
</scene>
7195
<!--Navigation Controller-->
7296
<scene sceneID="g2K-6U-C2D">
@@ -100,7 +124,7 @@
100124
</viewController>
101125
<placeholder placeholderIdentifier="IBFirstResponder" id="1JQ-CP-Uo0" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
102126
</objects>
103-
<point key="canvasLocation" x="2075.36231884058" y="554.46428571428567"/>
127+
<point key="canvasLocation" x="3648" y="855"/>
104128
</scene>
105129
</scenes>
106130
<resources>
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
//
2+
// Preview1ViewController.swift
3+
// Demo
4+
//
5+
// Created by i on 2022/11/20.
6+
//
7+
8+
import UIKit
9+
import StackKit
10+
11+
class Preview1ViewController: UIViewController {
12+
13+
let logoView = UIImageView()
14+
let nameLabel = UILabel()
15+
let briefLabel = UILabel()
16+
17+
let container = HStackView(alignment: .center)
18+
19+
override func viewDidLoad() {
20+
super.viewDidLoad()
21+
22+
// Do any additional setup after loading the view.
23+
24+
logoView.layer.cornerRadius = 16
25+
logoView.layer.cornerCurve = .continuous
26+
logoView.backgroundColor = .systemGroupedBackground
27+
28+
nameLabel.text = "iWECon/StackKit"
29+
nameLabel.font = .systemFont(ofSize: 14, weight: .medium)
30+
nameLabel.textColor = .black
31+
32+
briefLabel.text = "The best way to use HStack and VStack in UIKit, and also supports Spacer and Divider."
33+
briefLabel.font = .systemFont(ofSize: 12, weight: .light)
34+
briefLabel.textColor = .black
35+
briefLabel.numberOfLines = 0
36+
37+
container.layer.borderWidth = 1
38+
container.layer.borderColor = UIColor.black.cgColor
39+
container.layer.cornerRadius = 16
40+
container.layer.cornerCurve = .continuous
41+
42+
container.padding = UIEdgeInsets(top: 14, left: 14, bottom: 14, right: 14)
43+
container.distribution = .spacing(14) // or use `Spacer(length: 14)`
44+
45+
container.addContent {
46+
logoView.stack.size(80)
47+
VStackView(alignment: .left, distribution: .spacing(6)) {
48+
nameLabel
49+
briefLabel.stack.maxWidth(220)
50+
}
51+
}
52+
53+
self.view.addSubview(container)
54+
}
55+
56+
override func viewDidLayoutSubviews() {
57+
super.viewDidLayoutSubviews()
58+
59+
// or use `AutoLayout`
60+
container.pin.vCenter().hCenter().sizeToFit()
61+
}
62+
63+
/*
64+
// MARK: - Navigation
65+
66+
// In a storyboard-based application, you will often want to do a little preparation before navigation
67+
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
68+
// Get the new view controller using segue.destination.
69+
// Pass the selected object to the new view controller.
70+
}
71+
*/
72+
73+
}

Demo/preview.png

-320 KB
Binary file not shown.

Demo/preview1.png

39.5 KB
Loading

Demo/preview2.png

80.1 KB
Loading

0 commit comments

Comments
 (0)