ib 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 970354de7e8a0a2e965f215673de3a7c00d659a0
4
- data.tar.gz: 1c6d8deff6094f753953df2c79c2d6f1ada3423f
3
+ metadata.gz: b9877eb0ab9be9bf201b6f9dbe23416c7f5b5439
4
+ data.tar.gz: 5e6aab594f8197db1be1da81d80dcfee9104fbe7
5
5
  SHA512:
6
- metadata.gz: 00ad21b6fe42c935032d0e02bbcd88ffc855114741e0c339cc6193f76a5893e0fcedf127086cc6ea0f954481210aa91f68efbc9bffdb8eabb6fde0310188f374
7
- data.tar.gz: c4d14336f5f46fa82e418c9578b0e64fb13dd39126fd76b1f04229d9300cdc1a18e1d9a87e671e49263d7febb1b722af7fb69969cf4a5ec56a19e7ec900ef570
6
+ metadata.gz: 8876b001e5e7a8bc17fb19a5c84bd4d721c9e44d4f3ceb3540f7e7f78e149156499460c878eb550ab65d7d2b40b209b669e43e8a9891f62b419069a9815134b6
7
+ data.tar.gz: 32f58ddd91216fc1cf44af708597bc411356ab438f4199662d0d23d509fb4cf4b6a306bfdfeaa3375144747e4f9e9a07dfdbb2dcc76bd17e1f92c05121e89f7e
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # IB
2
2
 
3
- RubyMotion interface builder support (yes, with outlets)
3
+ RubyMotion Interface Builder support (yes, with outlets)
4
4
 
5
5
  <a href='http://spellhub.com/projects/project/7'><img src="http://spellhub.com/projects/status/7" height="18"></a>
6
- [![Build Status](https://travis-ci.org/yury/ib.png?branch=master)](https://travis-ci.org/yury/ib)
6
+ [![Build Status](https://travis-ci.org/rubymotion/ib.png?branch=master)](https://travis-ci.org/rubymotion/ib)
7
7
 
8
- [**Change Log**](https://github.com/yury/ib/wiki/Change-Log)
8
+ [**Change Log**](https://github.com/rubymotion/ib/wiki/Change-Log)
9
9
 
10
10
  ## Installation
11
11
 
@@ -119,6 +119,103 @@ class HelloController < UIViewController
119
119
  end
120
120
  ```
121
121
 
122
+ ### Support for IBDesignable classes, and IBInspectable properties
123
+ ###### Thanks to Robert Malko (aka malkomalko) for adding this feature!
124
+
125
+ To use this feature, you will need to create a simple framework using
126
+ Objective-C. Let's call our framework "DesignableKit". We'll define just one
127
+ public class, `DesignableView`, which will expose a `cornerRadius` property that
128
+ we want to be able to edit in Xcode, and have the results shown at design-time.
129
+
130
+ At a minimum, we need three files:
131
+
132
+ - Framework header, which defines version constants and includes the public headers. We'll call this `DesignableKit.h`
133
+ - At least one public header, e.g. `DesignableView.h`
134
+ - At least one implementation, e.g. `DesignableView.m`
135
+
136
+ mkdir -p frameworks/DesignableKit
137
+ touch frameworks/DesignableKit/DesignableKit.h
138
+ touch frameworks/DesignableKit/DesignableView.h
139
+ touch frameworks/DesignableKit/DesignableView.m
140
+
141
+ Add this framework to your project from the Rakefile, and add a new custom
142
+ option, introduced by **ib**:
143
+
144
+ app.vendor_project('frameworks/DesignableKit', :static, ib: true)
145
+
146
+ That `ib: true` option will be detected by **ib**, and that framework will be
147
+ included in the .xcodeproj that is created. So now let's write our custom view
148
+ code.
149
+
150
+ Unfortunately, we'll have to rely on objective-c for now. RubyMotion cannot yet
151
+ compile Swift files (RM 2.32 at the time of this writing), and we have not yet
152
+ added the ability to use a RubyMotion framework, *but this should be possible*!
153
+
154
+ ###### DesignableKit.h
155
+ ```objc
156
+ #import <UIKit/UIKit.h>
157
+
158
+ FOUNDATION_EXPORT double DesignableKitVersionNumber;
159
+ FOUNDATION_EXPORT const unsigned char DesignableKitVersionString[];
160
+
161
+ // import all the public headers of your framework
162
+ #import <DesignableKit/DesignableView.h>
163
+ ```
164
+ ###### DesignableView.h
165
+ ```objc
166
+ #import <UIKit/UIKit.h>
167
+
168
+ IB_DESIGNABLE
169
+ @interface DesignableView : UIView
170
+
171
+ @property (nonatomic) IBInspectable CGFloat cornerRadius;
172
+
173
+ @end
174
+ ```
175
+
176
+ ###### DesignableView.m
177
+ ```objc
178
+ // we make sure to call [self setup] from all the designated initializers (UIViews have *two*!)
179
+ #import "DesignableView.h"
180
+
181
+ @implementation DesignableView
182
+
183
+ - (instancetype)initWithCoder:(NSCoder *)aDecoder {
184
+ if (self = [super initWithCoder:aDecoder]) {
185
+ [self setup];
186
+ }
187
+ return self;
188
+ }
189
+
190
+ - (instancetype)initWithFrame:(CGRect)frame{
191
+ if (self = [super initWithFrame:frame]) {
192
+ [self setup];
193
+ }
194
+ return self;
195
+ }
196
+
197
+ - (void)prepareForInterfaceBuilder {
198
+ self.backgroundColor = [UIColor whiteColor];
199
+ }
200
+
201
+ - (void)setup {
202
+ self.cornerRadius = 0;
203
+ }
204
+
205
+ - (void)setCornerRadius:(CGFloat)cornerRadius {
206
+ _cornerRadius = cornerRadius;
207
+ self.layer.cornerRadius = cornerRadius;
208
+ }
209
+
210
+ @end
211
+ ```
212
+
213
+ Now open interface builder, and make your change!
214
+
215
+ rake ib
216
+
217
+
218
+
122
219
  ### Using Interface Builder
123
220
 
124
221
  Running `rake ib` will create a ib.xcodeproj in the root of your app and open XCode. You can create Storyboards or nibs, and save them in your `resources` directory in order to be picked up by RubyMotion.
@@ -144,24 +241,29 @@ If you find your version of the `ib` gem is not current, try `bundle update ib`.
144
241
 
145
242
  # Sample app
146
243
 
147
- Here is [sample app](https://github.com/yury/ibsample)
244
+ Here is a [sample app](https://github.com/rubymotion/ib/tree/master/samples/ibsample) using a storyboard, by **yury**.
148
245
 
149
246
  1. clone it
150
247
  2. run `bundle`
151
248
  3. run `rake ib` to change story board
152
249
  4. run `rake` to run app in simulator
153
250
 
154
- **Note** : this app is build for iOS 6.0
251
+ **Note** : this app was built for iOS 6.0
252
+
253
+ # IBDesignable Sample app
254
+
255
+ A [sample app](https://github.com/rubymotion/ib/tree/master/samples/ibdesignable) based on the code above. Written by **malkomalko**.
155
256
 
156
257
  # Another Sample app
157
258
 
158
- Here is [another sample app](https://github.com/hqmq/whereami)
259
+ Here is [another sample app](https://github.com/hqmq/whereami), by **hqmq**.
159
260
 
160
261
  # OS X Sample app
161
262
 
162
- Here is [OS X sample app](https://github.com/MarkVillacampa/motion-osx-ib)
263
+ Here is an [OS X sample app](https://github.com/MarkVillacampa/motion-osx-ib) by **MarkVillacampa**
163
264
 
164
- You can play around with it in the same way as the Sample app above. This sample uses a single xib file rather than a storyboard.
265
+ You can play around with it in the same way as the Sample app above. This sample
266
+ uses a single xib file rather than a storyboard.
165
267
 
166
268
  ## Contributing
167
269
 
data/ib.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |gem|
9
9
  gem.homepage = "https://github.com/yury/ib"
10
10
  gem.licenses = ['BSD']
11
11
 
12
- gem.files = `git ls-files`.split($\)
12
+ gem.files = `git ls-files`.split($\).reject { |f| f =~ %r{samples/} }
13
13
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
14
14
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15
15
  gem.name = "ib"
data/lib/ib/project.rb CHANGED
@@ -5,7 +5,9 @@ class IB::Project
5
5
 
6
6
  IB_PROJECT_NAME = 'ib.xcodeproj'
7
7
  DEFAULT_FRAMEWORKS = %W{QuartzCore CoreGraphics CoreData}
8
- RESOURCE_EXTENSIONS = %W{xcdatamodeld png jpg jpeg storyboard xib lproj}
8
+ RESOURCE_EXTENSIONS = %W{
9
+ xcdatamodeld png jpg jpeg storyboard xib lproj ttf otf
10
+ }
9
11
 
10
12
  def initialize options={}
11
13
  @platform = options[:platform] || detect_platform
@@ -110,9 +112,7 @@ class IB::Project
110
112
  target.add_system_framework framework
111
113
  end
112
114
 
113
- extra_frameworks.each do |framework|
114
- add_extra_framework framework
115
- end
115
+ extra_frameworks.each { |framework| add_extra_framework framework }
116
116
  end
117
117
 
118
118
  def extra_frameworks
@@ -120,10 +120,13 @@ class IB::Project
120
120
  end
121
121
 
122
122
  def add_extra_framework(framework)
123
- framework_name = framework.path.split('/').last
124
- framework_group = project.new_group(framework_name)
123
+ deployment_target = Motion::Project::App.config.deployment_target
124
+ framework_name = framework.path.split('/').last
125
+ framework_group = project.new_group(framework_name)
125
126
  framework_group.path = File.join(project_path, framework.path)
126
- framework_target = project.new_target(:framework, framework_name, platform)
127
+ framework_target = project.new_target(
128
+ :framework, framework_name, platform, deployment_target)
129
+
127
130
  Dir.glob("#{framework.path}/**/*.{h,m}") do |file|
128
131
  file_ref = framework_group.new_file File.join(project_path, file)
129
132
  framework_target.add_file_references([file_ref])
data/lib/ib/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module IB
3
- VERSION = '0.5.0'
3
+ VERSION = '0.6.0'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yury Korolev
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-06 00:00:00.000000000 Z
12
+ date: 2014-09-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xcodeproj