FLEXTabList.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //
  2. // FLEXTabList.h
  3. // FLEX
  4. //
  5. // Created by Tanner on 2/1/20.
  6. // Copyright © 2020 FLEX Team. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. NS_ASSUME_NONNULL_BEGIN
  10. @interface FLEXTabList : NSObject
  11. @property (nonatomic, readonly, class) FLEXTabList *sharedList;
  12. @property (nonatomic, readonly, nullable) UINavigationController *activeTab;
  13. @property (nonatomic, readonly) NSArray<UINavigationController *> *openTabs;
  14. /// Snapshots of each tab when they were last active.
  15. @property (nonatomic, readonly) NSArray<UIImage *> *openTabSnapshots;
  16. /// \c NSNotFound if no tabs are present.
  17. /// Setting this property changes the active tab to one of the already open tabs.
  18. @property (nonatomic) NSInteger activeTabIndex;
  19. /// Adds a new tab and sets the new tab as the active tab.
  20. - (void)addTab:(UINavigationController *)newTab;
  21. /// Closes the given tab. If this tab was the active tab,
  22. /// the most recent tab before that becomes the active tab.
  23. - (void)closeTab:(UINavigationController *)tab;
  24. /// Closes a tab at the given index. If this tab was the active tab,
  25. /// the most recent tab before that becomes the active tab.
  26. - (void)closeTabAtIndex:(NSInteger)idx;
  27. /// Closes all of the tabs at the given indexes. If the active tab
  28. /// is included, the most recent still-open tab becomes the active tab.
  29. - (void)closeTabsAtIndexes:(NSIndexSet *)indexes;
  30. /// A shortcut to close the active tab.
  31. - (void)closeActiveTab;
  32. /// A shortcut to close \e every tab.
  33. - (void)closeAllTabs;
  34. - (void)updateSnapshotForActiveTab;
  35. @end
  36. NS_ASSUME_NONNULL_END