Skip to content

Commit 227f8c0

Browse files
committed
Update README.md
1 parent 595b204 commit 227f8c0

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

README.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ platform :ios, '7.0'
5252
pod 'STNetTaskQueue'
5353
```
5454

55+
### Carthage
56+
```ruby
57+
github "kevin0571/STNetTaskQueue"
58+
```
59+
5560
### Use STNetTaskQueue in your project
5661
#### Step 1: Setup STNetTaskQueue after your app launch
5762
```objc
@@ -184,21 +189,21 @@ Conform STHTTPNetTaskRequestObject protocol
184189
@end
185190
```
186191
187-
#### Work with ReactiveCocoa for getting net task result
188-
192+
#### Use subscription block
189193
```objc
190-
[STNetTaskObserve(_openWeatherTask) subscribeCompleted:^(
191-
if (_openWeatherTask.error) { // Would be network issue
194+
[_openWeatherTask subscribeState:STNetTaskStateFinished usingBlock:^(STNetTask *task) {
195+
if (task.error) { // Would be network issue
192196
_resultLabel.text = @"Network Unavailable";
193197
_goBtn.hidden = YES;
194198
return;
195199
}
200+
196201
_resultLabel.text = [NSString stringWithFormat:@"%@\n%.1f°C", _openWeatherTask.place, _openWeatherTask.temperature];
197202
_goBtn.hidden = YES;
198203
}];
199204
```
200205

201-
#### Or use STNetTaskDelegate
206+
#### Use STNetTaskDelegate
202207

203208
```objc
204209
- (void)netTaskDidEnd:(STNetTask *)task
@@ -219,6 +224,21 @@ Conform STHTTPNetTaskRequestObject protocol
219224
_goBtn.hidden = YES;
220225
}
221226
```
227+
228+
#### Work with ReactiveCocoa for getting net task result
229+
230+
```objc
231+
[STNetTaskObserve(_openWeatherTask) subscribeCompleted:^(
232+
if (_openWeatherTask.error) { // Would be network issue
233+
_resultLabel.text = @"Network Unavailable";
234+
_goBtn.hidden = YES;
235+
return;
236+
}
237+
_resultLabel.text = [NSString stringWithFormat:@"%@\n%.1f°C", _openWeatherTask.place, _openWeatherTask.temperature];
238+
_goBtn.hidden = YES;
239+
}];
240+
```
241+
222242
For more details, download the example project or check out unit tests for usage references.
223243
224244
### Set max concurrent tasks count of STNetTaskQueue

STNetTaskQueue/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.0.15</string>
18+
<string>0.0.16</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

0 commit comments

Comments
 (0)