Stanwood

public struct Stanwood

Stanwood global instance

  • Checking if Snapshot is running.

    Declaration

    Swift

    public let isRunningSnapshot: Bool
  • The AbstractCollectionDataSource conforms to the CollectionDataSource protocol and implements AbstractCollectionDataSource.numberOfSections(in:) and AbstractCollectionDataSource.collectionView(_:numberOfItemsInSection:). It midiates the application data model DataType and Type for the UICollectionView.

    It is requried to subclass AbstractCollectionDataSource and override AbstractCollectionDataSource.collectionView(_:cellForItemAt:)

    Example: DataSource and Delegate design
    let items = [Element(id: "1"), Element(id: "2")]
    self.objects = Stanwood.Elements<Element>(items: items)
    
    self.dataSource = ElementDataSource(dataObject: objects)
    self.delegate = ElementDelegate(dataObject: objects)
    
    self.collectionView.dataSource = self.dataSource
    self.collectionView.delegate = self.delegate
    

    See also

    AbstractCollectionDelegate

    Objects

    DataType

    Type

    See more

    Declaration

    Swift

    @available(*, deprecated, message: "Migrate to `CollectionDataSource` https://github.com/stanwood/SourceModel_iOS")
    open class AbstractCollectionDataSource : NSObject, UICollectionViewDataSource, CollectionDataSource, DataSourceType
  • The AbstractCollectionDelegate conforms to the CollectionDelegate protocol. It allows you to manage the selection and highlighting of items in a collection view and to perform actions on those items. UICollectionView.

    Example: DataSource and Delegate design
    let items = [Element(id: "1"), Element(id: "2")]
    self.objects = Stanwood.Elements<Element>(items: items)
    
    self.dataSource = ElementDataSource(dataObject: objects)
    self.delegate = ElementDelegate(dataObject: objects)
    
    self.collectionView.dataSource = self.dataSource
    self.collectionView.delegate = self.delegate
    

    See also

    AbstractCollectionDataSource

    Objects

    DataType

    Type

    See more

    Declaration

    Swift

    @available(*, deprecated, message: "Migrate to `CollectionDelegate` https://github.com/stanwood/SourceModel_iOS")
    open class AbstractCollectionDelegate : NSObject, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, CollectionDelegate, DelegateSourceType
  • The AbstractTableDataSource conforms to the TableDataSource protocol and implements AbstractTableDataSource.numberOfSections(in:) and AbstractTableDataSource.tableView(_:numberOfRowsInSection:). It midiates the application data model DataType and Type for the UITableView.

    It is requried to subclass AbstractTableDataSource and override AbstractTableDataSource.tableView(_:cellForRowAt:)

    Example: DataSource and Delegate design
    let items = [Element(id: "1"), Element(id: "2")]
    self.objects = Stanwood.Elements<Element>(items: items)
    
    self.dataSource = ElementDataSource(dataType: objects)
    self.delegate = ElementDelegate(dataType: objects)
    
    self.tableView.dataSource = self.dataSource
    self.tableView.delegate = self.delegate
    

    See also

    AbstractCollectionDelegate

    Objects

    DataType

    Type

    See more

    Declaration

    Swift

    @available(*, deprecated, message: "Migrate to `TableDataSource` https://github.com/stanwood/SourceModel_iOS")
    open class AbstractTableDataSource : NSObject, UITableViewDataSource, TableDataSource, DataSourceType
  • The AbstractTableDelegate conforms to the TableDelegate protocol. It allows you to manage the selection and highlighting of items in a collection view and to perform actions on those items. UITableView.

    Example: DataSource and Delegate design
    let items = [Element(id: "1"), Element(id: "2")]
    self.objects = Stanwood.Elements<Element>(items: items)
    
    self.dataSource = ElementDataSource(dataType: objects)
    self.delegate = ElementDelegate(dataType: objects)
    
    self.tableView.dataSource = self.dataSource
    self.tableView.delegate = self.delegate
    

    See also

    AbstractTableDataSource

    Objects

    DataType

    Type

    See more

    Declaration

    Swift

    @available(*, deprecated, message: "Migrate to `TableDelegate` https://github.com/stanwood/SourceModel_iOS")
    open class AbstractTableDelegate : NSObject, UITableViewDelegate, TableDelegate, DelegateSourceType
  • Coding bridge is a helper struct that bridge NSCoding and Codable objects

    See more

    Declaration

    Swift

    public struct CodingBridge<Coding> : Codable where Coding : NSCoding
  • Elements holds an array of element types.

    Important: only supports a single section dataType. For a more complex solution, please conform to the DataType protocol.

    Example: DataSource and Delegate design
    let items = [Element(id: "1"), Element(id: "2")]
    self.objects = Stanwood.Elements<Element>(items: items)
    
    self.dataSource = ElementsDataSource(dataObject: elements)
    self.delegate = ElementsDelegate(dataObject: elements)
    
    self.collectionView.dataSource = self.dataSource
    self.collectionView.delegate = self.delegate
    

    See also

    DataType

    Type

    Typeable

    See more

    Declaration

    Swift

    @available(*, deprecated, message: "Migrate to https://github.com/stanwood/SourceModel_iOS")
    open class Elements<Element> : DataType, Codable where Element : Type, Element : Decodable, Element : Encodable, Element : Equatable
  • Vibration generator to provide user with feedback.

    Since

    Avalible in iOS 10.*
    See more

    Declaration

    Swift

    @available(iOS 10.0, *)
    open class FeedbackGenerator
  • A convinient observer class to add observers to NotificationCenter

    See more

    Declaration

    Swift

    public struct Observer
  • Sections holds an array of DataTypes.

    Example: DataSource and Delegate design
    let itemsOne = [Item(id: "1"), Item(id: "2")]
    let itemsTwo = [Meal(id: "pizza"), Meal(id: "ham")]
    
    let sectionOnce = Stanwoon.Elements<Item>(items: itemsOne)
    let sectionTwo = Stanwoon.Elements<Meal>(items: itemsTwo)
    
    self.sections = Stanwood.Sections(items: [sectionOnce, sectionTwo])
    
    self.dataSource = SectionsDataSource(dataObject: self.sections)
    self.delegate = SectionsDelegate(dataObject: self.sections)
    
    self.collectionView.dataSource = self.dataSource
    self.collectionView.delegate = self.delegate
    

    See also

    DataType

    Type

    Typeable

    See more

    Declaration

    Swift

    @available(*, deprecated, message: "Migrate to https://github.com/stanwood/SourceModel_iOS")
    open class Sections : DataType
  • Storage can be used to save or cache objects that conform to Codable protocl.

    See also

    Codable
    See more

    Declaration

    Swift

    public class Storage
  • Inherit AutoSizeableCell to conform to Autosizable protocol

    See more

    Declaration

    Swift

    @available(iOS 10.0, *)
    open class AutoSizeableCell : UICollectionViewCell, AutoSizeable