Merge pull request #31 from ryanmaxwell/master

Code snippets
This commit is contained in:
Robert Payne 2014-12-31 09:37:25 +13:00
commit 8991444481
3 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1,26 @@
<?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>IDECodeSnippetCompletionPrefix</key>
<string>snp_make</string>
<key>IDECodeSnippetCompletionScopes</key>
<array>
<string>CodeBlock</string>
</array>
<key>IDECodeSnippetContents</key>
<string>&lt;#view#&gt;.snp_makeConstraints { make in
&lt;#code#&gt;
}</string>
<key>IDECodeSnippetIdentifier</key>
<string>FF434629-7B96-4AB9-BD96-522275E7B106</string>
<key>IDECodeSnippetLanguage</key>
<string>Xcode.SourceCodeLanguage.Swift</string>
<key>IDECodeSnippetTitle</key>
<string>Snappy Constraint Make</string>
<key>IDECodeSnippetUserSnippet</key>
<true/>
<key>IDECodeSnippetVersion</key>
<integer>2</integer>
</dict>
</plist>

View File

@ -0,0 +1,26 @@
<?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>IDECodeSnippetCompletionPrefix</key>
<string>snp_remake</string>
<key>IDECodeSnippetCompletionScopes</key>
<array>
<string>TopLevel</string>
</array>
<key>IDECodeSnippetContents</key>
<string>&lt;#view#&gt;.snp_remakeConstraints { make in
&lt;#code#&gt;
}</string>
<key>IDECodeSnippetIdentifier</key>
<string>FD093546-D614-4311-82C3-E8FE842F62B1</string>
<key>IDECodeSnippetLanguage</key>
<string>Xcode.SourceCodeLanguage.Swift</string>
<key>IDECodeSnippetTitle</key>
<string>Snappy Constraint Remake</string>
<key>IDECodeSnippetUserSnippet</key>
<true/>
<key>IDECodeSnippetVersion</key>
<integer>0</integer>
</dict>
</plist>

View File

@ -2,7 +2,7 @@
Snappy is a light-weight layout framework which wraps AutoLayout with a nicer syntax. Snappy has its own layout DSL which provides a chainable way of describing your NSLayoutConstraints which results in layout code that is more concise and readable. Snappy supports both iOS and OS X.
> Snappy uses some Swift only features like function overloading it cannot be used from Objective-C. Because of this weve chosen to swap prefixes from Masonrys `mas_` to `snp_` so you can use both Masonry and Snappy in the same project.
> Snappy uses some Swift-only features like function overloading, so it cannot be used from Objective-C. Because of this weve chosen to swap prefixes from Masonrys `mas_` to `snp_` so you can use both Masonry and Snappy in the same project.
## Requirements
@ -274,6 +274,14 @@ func changeButtonPosition() {
}
```
## Code Snippets
Copy the included code snippets to ``~/Library/Developer/Xcode/UserData/CodeSnippets`` to write your snappy closures at lightning speed!
`snp_make` -> `<view>.snp_makeConstraints { make in <code> }`
`snp_remake` -> `<view>.snp_remakeConstraints { make in <code> }`
## TODO
* Eye candy