iOS & macOS Charting Documentation - SciChart iOS & macOS Charts SDK v4.x
SCIObjectPool
@interface SCIObjectPool<T> : NSObject <ISCICleanable>
Defines a simple object pool implementation which allows to reuse object instances.
-
Initializes a new
SCIObjectPool
instance.Declaration
Objective-C
- (nonnull instancetype)initWithFactory:(nonnull SCIFactory)factory;
Swift
init(factory: @escaping SCIFactory)
Parameters
factory
The default factory which allows to create new instances for pooling.
-
Gets the size of pool.
Declaration
Objective-C
@property (nonatomic, readonly) unsigned int count;
Swift
var count: UInt32 { get }
-
Get the value indicating whether the pool is empty.
Declaration
Objective-C
@property (nonatomic, readonly) BOOL isEmpty;
Swift
var isEmpty: Bool { get }
-
Gets the item from the pool, if pool is empty default object factory is used.
Declaration
Objective-C
- (nonnull T)get;
Swift
func get() -> T
Return Value
Object from pool.
-
Gets the item from the pool, if pool is empty default object factory is used.
Declaration
Objective-C
- (nonnull T)getWithFactory:(nonnull SCIFactory)factory;
Swift
func getWithFactory(_ factory: @escaping SCIFactory) -> T
Parameters
factory
The factory to use if pool doesn’t have enough items.
Return Value
Object from pool.
-
Put item into pool for further reusing.
Declaration
Objective-C
- (void)put:(nonnull T)item;
Swift
func put(_ item: T)
Parameters
item
The item to put into this pool.