Item

public class Item : SchemaItem

Undocumented

  • Title computed by implementations of the Item class

    Declaration

    Swift

    @objc
    dynamic var computedTitle: String { get }
  • Undocumented

    Declaration

    Swift

    var computedVars: [ComputedPropertyLink] { get }
  • Undocumented

    Declaration

    Swift

    var functions: [String : (_ args: [Any?]?) -> Any?]
  • Primary key used in the realm database of this Item

    Declaration

    Swift

    override public static func primaryKey() -> String?
  • Declaration

    Swift

    override public var description: String { get }
  • Undocumented

    See more

    Declaration

    Swift

    enum ItemError : Error
  • Undocumented

    Declaration

    Swift

    var changelog: Results<AuditItem>? { get }
  • Declaration

    Swift

    required init()
  • Undocumented

    Declaration

    Swift

    required init(from _: Decoder) throws
  • Undocumented

    Declaration

    Swift

    public func cast() -> Self
  • Get string, or string representation (e.g. “true) from property name

    Declaration

    Swift

    public func getString(_ name: String) -> String?

    Parameters

    name

    property name

    Return Value

    string representation

  • Get the type of Item

    Declaration

    Swift

    public func getType() -> Item.Type?

    Return Value

    type of the Item

  • Determines whether item has property

    Declaration

    Swift

    public func hasProperty(_ propName: String) -> Bool

    Parameters

    propName

    name of the property

    Return Value

    boolean indicating whether Item has the property

  • Get property value

    Declaration

    Swift

    public func get<T>(_ name: String, type _: T.Type = T.self) -> T?

    Parameters

    name

    property name

  • Set property to value, which will be persisted in the local database

    Declaration

    Swift

    public func set(_ name: String, _ value: Any?)

    Parameters

    name

    property name

    value

    value

  • Undocumented

    Declaration

    Swift

    public func reverseEdges(_ edgeType: String) -> Results<Edge>?
  • Undocumented

    Declaration

    Swift

    public func reverseEdge(_ edgeType: String) -> Edge?
  • Undocumented

    Declaration

    Swift

    public func edges(_ edgeType: String) -> Results<Edge>?
  • Undocumented

    Declaration

    Swift

    public func edges(_ edgeTypes: [String]) -> Results<Edge>?
  • Undocumented

    Declaration

    Swift

    public func edge(_ edgeType: String) -> Edge?
  • Undocumented

    Declaration

    Swift

    public func edge(_ edgeTypes: [String]) -> Edge?
  • When distinct is set to false multiple of the same relationship type are allowed

    Declaration

    Swift

    public func link(
        _ item: Object,
        type edgeType: String = "edge",
        sequence: EdgeSequencePosition? = nil,
        label: String? = nil,
        distinct: Bool = false,
        overwrite: Bool = true
    ) throws -> Edge?
  • Undocumented

    Declaration

    Swift

    public func unlink(_ edge: Edge) throws
  • Undocumented

    Declaration

    Swift

    public func unlink(_ item: Item, type edgeType: String? = nil, all: Bool = true) throws
  • Toggle boolean property

    Declaration

    Swift

    public func toggle(_ name: String) throws

    Parameters

    name

    property name

  • Compares value of this Items property with the corresponding property of the passed items property

    Declaration

    Swift

    public func isEqualProperty(_ propName: String, _ item: Item) -> Bool

    Parameters

    propName

    name of the compared property

    item

    item to compare against

    Return Value

    boolean indicating whether the property values are the same

  • Undocumented

    Declaration

    Swift

    func isEqualValue(_ a: Any?, _ b: Any?) -> Bool
  • Safely merges the passed item with the current Item. When there are merge conflicts, meaning that some other process requested changes for the same properties with different values, merging is not performed.

    Declaration

    Swift

    public func safeMerge(_ item: Item) -> Bool

    Parameters

    item

    item to be merged with the current Item

    Return Value

    boolean indicating the succes of the merge

  • merges the the passed Item in the current item

    Declaration

    Swift

    public func merge(_ item: Item, _ mergeDefaults: Bool = false)

    Parameters

    item

    passed Item

    mergeDefaults

    boolean describing how to merge. If mergeDefault == true: Overwrite only the property values have not already been set (nil). else: Overwrite all property values with the values from the passed item, with the exception that values cannot be set from a non-nil value to nil.

  • update the dateAccessed property to the current date

    Declaration

    Swift

    public func accessed()
  • update the dateAccessed property to the current date

    Declaration

    Swift

    public func modified(_ updatedFields: [String])
  • compare two dataItems

    Declaration

    Swift

    public static func == (lhs: Item, rhs: Item) -> Bool

    Parameters

    lhs

    Item 1

    rhs

    Item 2

    Return Value

    boolean indicating equality

  • Reads Items from file

    Throws

    Decoding error

    Declaration

    Swift

    public class func fromJSONFile(_ file: String, ext: String = "json") throws -> [Item]

    Parameters

    file

    filename (without extension)

    ext

    extension

    Return Value

    Array of deserialized Items

  • Read Item from string

    Throws

    Decoding error

    Declaration

    Swift

    public class func fromJSONString(_ json: String) throws -> [Item]

    Parameters

    json

    string to parse

    Return Value

    Array of deserialized Items