PTDocumentTabManager
@interface PTDocumentTabManager : NSObject
This class tracks a list of PTDocumentTabItem
instances and allows manipulation of
the order and selection.
-
A list of the
PTDocumentTabItem
instances managed by the receiver.Declaration
Objective-C
@property (nonatomic, copy, readonly) NSArray<PTDocumentTabItem *> *_Nonnull items;
Swift
var items: [PTDocumentTabItem] { get }
-
The index of the currently selected item in the
items
list.The value of this property is
NSNotFound
when there are no items.Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readwrite) NSUInteger selectedIndex;
Swift
var selectedIndex: UInt { get set }
-
The currently selected item in the
items
list.The value of this property is
nil
when there are no items.Declaration
Objective-C
@property (nonatomic, weak, readwrite, nullable) PTDocumentTabItem *selectedItem;
Swift
weak var selectedItem: PTDocumentTabItem? { get set }
-
Add a
PTDocumentTabItem
instance to the list of items. The item is added to the end of theitems
list, if it is not already in the list.Declaration
Objective-C
- (void)addItem:(nonnull PTDocumentTabItem *)item;
Swift
func addItem(_ item: PTDocumentTabItem)
Parameters
item
The
PTDocumentTabItem
instance to add to the list of items. -
Insert a
PTDocumentTabItem
instance into the list of items at the specified index.Declaration
Objective-C
- (void)insertItem:(nonnull PTDocumentTabItem *)item atIndex:(NSUInteger)index;
Swift
func insertItem(_ item: PTDocumentTabItem, at index: UInt)
Parameters
item
The
PTDocumentTabItem
instance to insert into the list of items.index
The index in the
items
list at which to insert the item. -
Remove the specified
PTDocumentTabItem
instance from the list of items.Declaration
Objective-C
- (void)removeItem:(nonnull PTDocumentTabItem *)item;
Swift
func removeItem(_ item: PTDocumentTabItem)
Parameters
item
The
PTDocumentTabItem
instance to remove from the list of items. -
Remove the
PTDocumentTabItem
instance from theitems
list at the specified index.Declaration
Objective-C
- (void)removeItemAtIndex:(NSUInteger)index;
Swift
func removeItem(at index: UInt)
Parameters
index
The index of the item in the
items
list to remove. -
Move the item located at
index
in theitems
list tonewIndex
.Declaration
Objective-C
- (void)moveItemAtIndex:(NSUInteger)index toIndex:(NSUInteger)newIndex;
Swift
func moveItem(at index: UInt, to newIndex: UInt)
-
Whether an item is currently being moved from one index to another.
The value is
YES
during a call to the-moveItemAtIndex:toIndex:
method.Declaration
Objective-C
@property (nonatomic, readonly, getter=isMoving) BOOL moving;
Swift
var isMoving: Bool { get }
-
The default location at which the list of items is saved.
Declaration
Objective-C
@property (class, nonatomic, strong, readonly) NSURL *_Nonnull savedItemsURL;
Swift
class var savedItemsURL: URL { get }
-
Save the current list of items to disk at the location specified by
PTDocumentTabManager.savedItemsURL
.Declaration
Objective-C
- (void)saveItems;
Swift
func saveItems()
-
Save the current list of items to disk at the specified location.
Declaration
Objective-C
- (void)saveItemsToURL:(nonnull NSURL *)savedItemsURL;
Swift
func saveItems(to savedItemsURL: URL)
Parameters
savedItemsURL
The location at which to save the list of items.
-
Restore the list of items from disk at the location specified by
PTDocumentTabManager.savedItemsURL
.Declaration
Objective-C
- (void)restoreItems;
Swift
func restoreItems()
-
Restore the list of items from disk at the specified location.
Declaration
Objective-C
- (void)restoreItemsFromURL:(nonnull NSURL *)savedItemsURL;
Swift
func restoreItems(from savedItemsURL: URL)
Parameters
savedItemsURL
The location from which to restore the list of items.