XuniObservableArray Class Reference

Conforms to ObjectType
__covariant
Declared in ObservableArray.h

Overview

Class XuniObservableArray.

– countByEnumeratingWithState:objects:count:

Do the enumeration (for for-in cycle)

- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *_Null_unspecified)state objects:(id __unsafe_unretained _Nullable [ _Nonnull ])buffer count:(NSUInteger)len

Parameters

state

the enumeration state.

buffer

the data buffer.

len

the traversed items count

Return Value

return the data size flag

Discussion

Do the enumeration (for for-in cycle)

Declared In

ObservableArray.h

– objectAtIndexedSubscript:

Get the object by subscript index.

- (ObjectType _Nonnull)objectAtIndexedSubscript:(int)key

Parameters

key

the subscript

Return Value

return the object by provided subscript

Discussion

Get the object by subscript index.

Declared In

ObservableArray.h

– setObject:atIndexedSubscript:

Set the object by subscript index

- (void)setObject:(ObjectType _Nonnull)obj atIndexedSubscript:(int)key

Parameters

obj

the object.

key

the subscript

Discussion

Set the object by subscript index

Declared In

ObservableArray.h

  sourceArray

Gets the array of the source.

@property (readonly) NSArray<ObjectType> *sourceArray

Discussion

Gets the array of the source.

Declared In

ObservableArray.h

  count

Get the count of an array.

@property (readonly) NSUInteger count

Discussion

Get the count of an array.

Declared In

ObservableArray.h

– objectAtIndex:

Get an object of an array.

- (ObjectType _Nonnull)objectAtIndex:(NSUInteger)index

Parameters

index

the object index.

Return Value

return an object.

Discussion

Get an object of an array.

Declared In

ObservableArray.h

– indexOfObject:

Get the index of an object.

- (NSUInteger)indexOfObject:(ObjectType _Nonnull)anObject

Parameters

anObject

an object.

Return Value

return the object index.

Discussion

Get the index of an object.

Declared In

ObservableArray.h

– addObject:

Add an object into the array.

- (void)addObject:(ObjectType _Nonnull)anObject

Parameters

anObject

an object.

Discussion

Add an object into the array.

Declared In

ObservableArray.h

– addObjectsFromArray:

Add an array of objects into the array.

- (void)addObjectsFromArray:(NSArray<ObjectType> *_Nonnull)array

Parameters

array

an array.

Discussion

Add an array of objects into the array.

Declared In

ObservableArray.h

– insertObject:atIndex:

Insert an object into the array at the index.

- (void)insertObject:(ObjectType _Nonnull)anObject atIndex:(NSUInteger)index

Parameters

anObject

an object.

index

the insert index.

Discussion

Insert an object into the array at the index.

Declared In

ObservableArray.h

– removeAllObjects

Remove all objects from the array.

- (void)removeAllObjects

Discussion

Remove all objects from the array.

Declared In

ObservableArray.h

– removeObject:

Remove an object from the array.

- (void)removeObject:(ObjectType _Nonnull)anObject

Parameters

anObject

an object.

Discussion

Remove an object from the array.

Declared In

ObservableArray.h

– removeObjectAtIndex:

Remove an object from the array at the index.

- (void)removeObjectAtIndex:(NSUInteger)index

Parameters

index

the index.

Discussion

Remove an object from the array at the index.

Declared In

ObservableArray.h

– replaceObjectAtIndex:withObject:

Replace an object of the array at the index with another object.

- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(ObjectType _Nonnull)anObject

Parameters

index

the index.

anObject

an object.

Discussion

Replace an object of the array at the index with another object.

Declared In

ObservableArray.h

– init

Initialize an instance for XuniObservableArray.

- (instancetype _Nonnull)init

Return Value

return an instance of XuniObservableArray.

Discussion

Initialize an instance for XuniObservableArray.

Declared In

ObservableArray.h

– initWithCapacity:

Initialize an instance for XuniObservableArray with capacity.

- (instancetype _Nonnull)initWithCapacity:(NSUInteger)numItems

Parameters

numItems

the number of items.

Return Value

an instance for XuniObservableArray.

Discussion

Initialize an instance for XuniObservableArray with capacity.

Declared In

ObservableArray.h

– beginUpdate

Suspends notifications until the next call to endUpdate.

- (void)beginUpdate

Discussion

Suspends notifications until the next call to endUpdate.

Declared In

ObservableArray.h

– endUpdate

Resumes notifications suspended by a call to beginUpdate.

- (void)endUpdate

Discussion

Resumes notifications suspended by a call to beginUpdate.

Declared In

ObservableArray.h

– isUpdating

Gets a value that indicates whether notifications are currently suspended.

- (BOOL)isUpdating

Return Value

return a boolean value.

Discussion

Gets a value that indicates whether notifications are currently suspended.

Declared In

ObservableArray.h

– deferUpdate:

Executes a function within a beginUpdate/endUpdate block.

- (void)deferUpdate:(void ( ^ _Nonnull ) ( ))fn

Parameters

fn

a block.

Discussion

Executes a function within a beginUpdate/endUpdate block.

Declared In

ObservableArray.h

  collectionChanged

Gets or sets collectionChanged.

@property XuniEvent<XuniNotifyCollectionChangedEventArgs*> *collectionChanged

Discussion

Gets or sets collectionChanged.

Declared In

ObservableArray.h

– onCollectionChanged:

Raises the collectionChanged event.

- (void)onCollectionChanged:(XuniNotifyCollectionChangedEventArgs *_Nonnull)e

Parameters

e

an object of XuniNotifyCollectionChangedEventArgs.

Discussion

Raises the collectionChanged event.

Declared In

ObservableArray.h

– raiseCollectionChanged:items:startingIndex:oldItems:oldStartingIndex:

Raises the collectionChanged event.

- (void)raiseCollectionChanged:(XuniNotifyCollectionChangedAction)action items:(NSMutableArray *_Nullable)items startingIndex:(long)startingIndex oldItems:(NSMutableArray *_Nullable)oldItems oldStartingIndex:(long)oldStartingIndex

Parameters

action

how collection changed.

items

the items.

startingIndex

start index of the new items in the collection.

oldItems

old items removed from the collection.

oldStartingIndex

start index of the old items removed from the collection.

Discussion

Raises the collectionChanged event.

Declared In

ObservableArray.h