From df9df818dd2254f9f884f7bd814141c694f5a905 Mon Sep 17 00:00:00 2001 From: Shiva Huang Date: Mon, 5 Aug 2019 13:16:46 +0800 Subject: [PATCH] Add Playground Sample (#608) --- README.md | 7 +++++ SnapKit.xcworkspace/contents.xcworkspacedata | 3 ++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 +++++ SnapKitPlayground.playground/Contents.swift | 29 +++++++++++++++++++ .../contents.xcplayground | 4 +++ .../timeline.xctimeline | 6 ++++ 6 files changed, 57 insertions(+) create mode 100644 SnapKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 SnapKitPlayground.playground/Contents.swift create mode 100644 SnapKitPlayground.playground/contents.xcplayground create mode 100644 SnapKitPlayground.playground/timeline.xctimeline diff --git a/README.md b/README.md index 32b6518..0945ce6 100644 --- a/README.md +++ b/README.md @@ -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/) diff --git a/SnapKit.xcworkspace/contents.xcworkspacedata b/SnapKit.xcworkspace/contents.xcworkspacedata index 6814365..c59d3d6 100644 --- a/SnapKit.xcworkspace/contents.xcworkspacedata +++ b/SnapKit.xcworkspace/contents.xcworkspacedata @@ -1,6 +1,9 @@ + + diff --git a/SnapKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SnapKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/SnapKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/SnapKitPlayground.playground/Contents.swift b/SnapKitPlayground.playground/Contents.swift new file mode 100644 index 0000000..d84900a --- /dev/null +++ b/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() diff --git a/SnapKitPlayground.playground/contents.xcplayground b/SnapKitPlayground.playground/contents.xcplayground new file mode 100644 index 0000000..3b15108 --- /dev/null +++ b/SnapKitPlayground.playground/contents.xcplayground @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/SnapKitPlayground.playground/timeline.xctimeline b/SnapKitPlayground.playground/timeline.xctimeline new file mode 100644 index 0000000..bf468af --- /dev/null +++ b/SnapKitPlayground.playground/timeline.xctimeline @@ -0,0 +1,6 @@ + + + + +