Skip to content

Commit ef31991

Browse files
gunwooterryglwithu06
authored andcommitted
More concise introduction, fix typos in README (#2)
1 parent 1544966 commit ef31991

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

README.md

+16-21
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,16 @@ var body: Interface {
4949

5050
## Why IBKit
5151

52-
Storyboard, XIB is a kind of XML file. However have you ever edited a storyboard or XIB by hand? Probably not. It isn't easy to read or edit. Storyboards and XIBs have many troublesome properties such as `id`, `destination`, etc. Futhermore these contain a fairly large amount of XML. So it is impossible to see what’s changed when someone opens a pull request with its modification.
52+
IBKit lets you write intuitive UI code in a collaboration-friendly way.
5353

54-
Worse, Storyboards have a habit of growing larger and larger over time. they might start off small, but then you add another view controller and another, and another, and suddenly you realize that you have ten screens of data in a single file, and any source control changes you make are suddenly quite painful.
54+
Xcode storyboards and interface builders have advantages in visual representation, but have critical weaknesses:
5555

56-
Also, Interface Builder doesn’t know much about the Swift code, and vice versa. It makes you have lots of unsafe functionality. For example, we Ctrl-drag from IB into our code to connect something to an action. Then what if we delete that action on the code? The code still compiles well but it will be crashed!
56+
- Readability. IB files are designed to be read by Xcode, not humans.
57+
- Collaboration. Due to low readability, it is hard to review changes and resolve conflicts.
58+
- Scope handling. A single storyboard file keeps growing as your codebase grows. If you don't pay enough attention, you'll find a single file contains tens of screens.
59+
- Safety. Interface builders don't know much about your Swift code. Missing references are not caught at compile-time and lead to runtime crash.
5760

58-
~Finally Interface Builder doesn't work as intended. Named colors that set from xib can not be changed in `viewDidLoad`, `viewWillAppear`, `awakeFromNib` method.~
59-
60-
Nevertheless, Storyboard, XIB has powerful advantages. It gives you a very good visual representation. Also it is easy of use. When you create a ViewController programmatically, it has a lot of codes and looks too verbose.
61-
62-
Basically, IBKit is a tool for programmtically UI. By using declarative style, you can understand the UI intuitively. Also IBKit has a simple `Preview` class for Xcode Previews. You can be given a realtime visual representation easily.
63-
64-
IBKit is the most straight forward, the easiest way to implement your UI.
61+
IBKit has an intuitive syntax written in Swift code, inspired by SwiftUI, and supports easy integration with Xcode Previews.
6562

6663
## Requirements
6764

@@ -71,10 +68,9 @@ IBKit is the most straight forward, the easiest way to implement your UI.
7168

7269
## Installation
7370

74-
`IBKit` doesn't contain any external dependencies.
75-
These are currently support options:
71+
`IBKit` requires no external dependencies. Supported installation options are:
7672

77-
### Cocoapods
73+
### CocoaPods
7874
```
7975
# Podfile
8076
user_framework!
@@ -86,7 +82,7 @@ Replace `YOUR_TARGET_NAME` and then, in the `Podfile` directory, type:
8682
```
8783
$ pod install
8884
```
89-
> Deployment target 11.0+ is required to install IBKit via Cocoapods.
85+
> Deployment target 11.0+ is required to install IBKit via CocoaPods.
9086
9187
### Swift Package Manager
9288

@@ -129,7 +125,7 @@ class PriceView: UIView, InterfaceBuilder {
129125
}
130126
```
131127

132-
Declare user interfaces in the body
128+
Declare user interfaces in `body`.
133129

134130
```Swift
135131
ViewGroup {
@@ -153,7 +149,7 @@ ViewGroup {
153149
}
154150
```
155151

156-
Instantiate your view(Controller) using a `loadFromIB` method.
152+
Instantiate your view (or view controller) using a `loadFromIB` method.
157153

158154
```Swift
159155
let view = PriceView.loadFromIB()
@@ -168,11 +164,10 @@ override init(frame: CGRect) {
168164
}
169165
```
170166

171-
### Xcode Preivews
172-
173-
1. To use Xcode Previews, SwiftUI framework must be imported weakly on your project.
167+
### Xcode Previews
174168

175-
Open XcodeProject > `Build Phases` > `Link Binary With Libraries` > Add `SwifTUI` > Change SwiftUI status to `Optional`
169+
1. Import the SwiftUI framework to your project. (Import **WEAKLY** if you support < iOS 13 devices, otherwise it crashes)
170+
> Open XcodeProject > `Build Phases` > `Link Binary With Libraries` > Add `SwifTUI` > Change SwiftUI status to `Optional`
176171
177172
2. Conform to `PreviewProvider` protocol.
178173

@@ -198,4 +193,4 @@ static var previews: some View {
198193
## Contribution
199194
Any pull requests and bug reports are welcome!
200195

201-
Feel free to make a pull request.
196+
Feel free to make a pull request.

0 commit comments

Comments
 (0)