Skip to content

Commit

Permalink
Add Playground Sample (#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShivaHuang authored and robertjpayne committed Aug 5, 2019
1 parent d482f59 commit df9df81
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Expand Up @@ -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

- [Documentation](http://snapkit.io/docs/)
Expand Down
3 changes: 3 additions & 0 deletions SnapKit.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions SnapKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -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>
29 changes: 29 additions & 0 deletions SnapKitPlayground.playground/Contents.swift
@@ -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()
4 changes: 4 additions & 0 deletions SnapKitPlayground.playground/contents.xcplayground
@@ -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>
6 changes: 6 additions & 0 deletions SnapKitPlayground.playground/timeline.xctimeline
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Timeline
version = "3.0">
<TimelineItems>
</TimelineItems>
</Timeline>

0 comments on commit df9df81

Please sign in to comment.