Skip to content

Commit 11824e2

Browse files
authored
Merge pull request ViewDeck#563 from iv-mexx/master
Expose open- and close calls with completion block
2 parents ade45fa + 277dd13 commit 11824e2

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

ViewDeck/IIViewDeckController.h

+37
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ FOUNDATION_EXPORT NSString* NSStringFromIIViewDeckSide(IIViewDeckSide side);
257257
controller that the view deck controller is currently showing.
258258
259259
@see openSide:animated:
260+
@see openSide:animated:completion:
260261
*/
261262
@property (nonatomic) IIViewDeckSide openSide;
262263

@@ -271,23 +272,59 @@ FOUNDATION_EXPORT NSString* NSStringFromIIViewDeckSide(IIViewDeckSide side);
271272
dismissing the open side first.
272273
273274
@see closeSide:
275+
@see closeSide:animated:completion:
274276
275277
@param side The side you want to open.
276278
@param animated `YES` if you want to animate the transition, `NO` otherwise.
277279
*/
278280
- (void)openSide:(IIViewDeckSide)side animated:(BOOL)animated;
279281

282+
283+
/**
284+
Opens the passed in side.
285+
286+
Opening a side that is already open does nothing.
287+
288+
@note You can only switch between no view controller (`IIViewDeckSideNone`) or
289+
either the left (`IIViewDeckSideLeft`) or right (`IIViewDeckSideRight`)
290+
view controller. You can not switch directly from left to right without
291+
dismissing the open side first.
292+
293+
@see closeSide:
294+
@see closeSide:animated:
295+
296+
@param side The side you want to open.
297+
@param animated `YES` if you want to animate the transition, `NO` otherwise.
298+
@param completion Completion block that will be called when the animation completed
299+
*/
300+
- (void)openSide:(IIViewDeckSide)side animated:(BOOL)animated completion:(nullable void(^)(BOOL cancelled))completion;
301+
302+
280303
/**
281304
Closes the currently open side.
282305
283306
Closing a side when no side is open does nothing.
284307
308+
@see closeSide:animated:completion:
285309
@see openSide:animated:
286310
287311
@param animated `YES` if you want to animate the transition, `NO` otherwise.
288312
*/
289313
- (void)closeSide:(BOOL)animated;
290314

315+
/**
316+
Closes the currently open side.
317+
318+
Closing a side when no side is open does nothing.
319+
320+
@see closeSide:animated:
321+
@see openSide:animated:
322+
323+
@param animated `YES` if you want to animate the transition, `NO` otherwise.
324+
@param completion Completion block that will be called when the animation completed
325+
*/
326+
- (void)closeSide:(BOOL)animated completion:(nullable void(^)(BOOL cancelled))completion;
327+
291328

292329
/// @name Customizing Transitions
293330

ViewDeck/IIViewDeckController.mm

+10-2
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,11 @@ - (void)setOpenSide:(IIViewDeckSide)openSide {
236236
}
237237

238238
- (void)openSide:(IIViewDeckSide)side animated:(BOOL)animated {
239-
[self openSide:side animated:animated notify:NO completion:NULL];
239+
[self openSide:side animated:animated completion:NULL];
240+
}
241+
242+
- (void)openSide:(IIViewDeckSide)side animated:(BOOL)animated completion:(nullable void(^)(BOOL cancelled))completion {
243+
[self openSide:side animated:animated notify:NO completion:completion];
240244
}
241245

242246
- (void)openSide:(IIViewDeckSide)side animated:(BOOL)animated notify:(BOOL)notify completion:(nullable void(^)(BOOL cancelled))completion {
@@ -319,7 +323,11 @@ - (void)openSide:(IIViewDeckSide)side animated:(BOOL)animated notify:(BOOL)notif
319323
}
320324

321325
- (void)closeSide:(BOOL)animated {
322-
[self closeSide:animated notify:NO completion:NULL];
326+
[self closeSide:animated completion:NULL];
327+
}
328+
329+
- (void)closeSide:(BOOL)animated completion:(nullable void(^)(BOOL cancelled))completion {
330+
[self openSide:IIViewDeckSideNone animated:animated notify:NO completion:completion];
323331
}
324332

325333
- (void)closeSide:(BOOL)animated notify:(BOOL)notify completion:(nullable void(^)(BOOL cancelled))completion {

0 commit comments

Comments
 (0)