Storable

public protocol Storable

Storable protocol

The struct should conform to this protocol.

sample

struct Basic: Storable {
   let name: String
   let age: Float
   let number: Int

init(warehouse: JSONWarehouse) { self.name = warehouse.get(name) ?? default self.age = warehouse.get(age) ?? 20.5 self.number = warehouse.get(number) ?? 10 } }

  • Struct initialization

    Declaration

    Swift

    init?(warehouse: Warehouseable)
  • toDictionary() Default implementation

    Dictionary representation

    Returns the dictioanry representation of the current struct - returns: [String: Any]

    Default Implementation

    Dictionary representation Returns the dictioanry representation of the current struct

    Declaration

    Swift

    func toDictionary() -> [String: Any]

    Return Value

    [String: Any]