Add Playground Sample (#608)

This commit is contained in:
Shiva Huang 2019-08-05 13:16:46 +08:00 committed by Robert Payne
parent d482f59648
commit df9df818dd
6 changed files with 57 additions and 0 deletions

View File

@ -114,6 +114,13 @@ class MyViewController: UIViewController {
} }
``` ```
### Playground
You can try SnapKit in Playground.
**Note:**
> To try SnapKit in playground, open `SnapKit.xcworkspace` and build SnapKit.framework for any simulator first.
### Resources ### Resources
- [Documentation](http://snapkit.io/docs/) - [Documentation](http://snapkit.io/docs/)

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Workspace <Workspace
version = "1.0"> version = "1.0">
<FileRef
location = "group:SnapKitPlayground.playground">
</FileRef>
<FileRef <FileRef
location = "container:SnapKit.xcodeproj"> location = "container:SnapKit.xcodeproj">
</FileRef> </FileRef>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,29 @@
//: A UIKit based Playground for presenting user interface
// To use this playground, build SnapKit.framework for any simulator first.
import SnapKit
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
override func loadView() {
let view = UIView()
view.backgroundColor = .white
let label = UILabel()
label.text = "Hello World!"
label.textColor = .black
view.addSubview(label)
label.snp.makeConstraints { (make) in
make.left.equalToSuperview().offset(150)
make.top.equalToSuperview().offset(200)
make.size.equalTo(CGSize(width: 200, height: 20))
}
self.view = view
}
}
// Present the view controller in the Live View window
PlaygroundPage.current.liveView = MyViewController()

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios' executeOnSourceChanges='true'>
<timeline fileName='timeline.xctimeline'/>
</playground>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Timeline
version = "3.0">
<TimelineItems>
</TimelineItems>
</Timeline>