README.md in bubble-wrap-1.4.0 vs README.md in bubble-wrap-1.5.0.rc1
- old
+ new
@@ -21,14 +21,14 @@
```ruby
require 'bubble-wrap'
```
-If you are requiring bubble-wrap for RubyMotion 2.0 (iOS or OS X), use Bundler and specify version greater than 1.3.0:
+If you using Bundler:
```ruby
-gem "bubble-wrap", "~> 1.3.0"
+gem "bubble-wrap", "~> 1.4.0"
```
BubbleWrap is split into multiple modules so that you can easily choose which parts
are included at compile-time.
@@ -477,10 +477,16 @@
button.when(UIControlEventTouchUpInside) do
self.view.backgroundColor = UIColor.redColor
end
```
+Set the use_weak_callbacks flag so the blocks do not retain a strong reference to self:
+
+```ruby
+BubbleWrap.use_weak_callbacks = true
+```
+
### UIBarButtonItem
`BW::UIBarButtonItem` is a subclass of `UIBarButtonItem` with an natural Ruby syntax.
#### Constructors
@@ -620,9 +626,23 @@
p json['id']
elsif response.status_code.to_s =~ /40\d/
App.alert("Login failed")
else
App.alert(response.error_message)
+ end
+end
+```
+
+To upload files to a server, provide a `files:` hash:
+
+```ruby
+data = {token: "some-api-token"}
+avatar_data = UIImagePNGRepresentation(UIImage.imageNamed("some-image"))
+avatar = { data: avatar_data, filename: "some-image.png", content_type: "image/png" }
+
+BW::HTTP.post("http://foo.bar.com/", {payload: data}, files: { avatar: avatar }) do |response|
+ if response.ok?
+ # files are uploaded
end
end
```
A `:download_progress` option can also be passed. The expected object