A_RVP_Cocoa_SDK_Object

public class A_RVP_Cocoa_SDK_Object : NSObject, Sequence

This is the fundamental base class for the various data item classes. It aggregates a bunch of generic functionality that can be applied across the board.

Public Data Structures

  • This is a change record struct.

    Declaration

    Swift

    public struct RVP_Change_Record

Public Properties and Calculated Properties

  • This returns keys that are the same as calculated public properties, so you can use it to get the methods/calculated properties you need to make changes.

    Declaration

    Swift

    public var asDictionary: [String : Any?] { get }

    Return Value

    all of the values for this object, as a Dictionary. READ ONLY

  • id

    Declaration

    Swift

    public var id: Int { get }

    Return Value

    the object ID, as an Int. READ ONLY

  • Declaration

    Swift

    public var name: String { get set }

    Return Value

    the object name, as a String

  • Declaration

    Swift

    public var lang: String { get set }

    Return Value

    the language

  • Declaration

    Swift

    public var isWriteable: Bool { get }

    Return Value

    true, if the current login can edit this record. READ ONLY

  • Declaration

    Swift

    public var isDirty: Bool { get }

    Return Value

    true, if the data in the object has been changed since it was first created. READ ONLY

  • Declaration

    Swift

    public var isNew: Bool { get }

    Return Value

    true, if the object is a new object that did not come from the server. READ ONLY

  • NOTE: Although this will let anyone with write permission set the token, it will not be accepted on the server, unless the admin also has the token.

    Declaration

    Swift

    public var readToken: Int { get set }

    Return Value

    the read token, as an Int.

  • NOTE: Although this will let anyone with write permission set the token, it will not be accepted on the server, unless the admin also has the token.

    Declaration

    Swift

    public var writeToken: Int { get set }

    Return Value

    the write token, as an Int.

  • Declaration

    Swift

    public var lastAccess: Date? { get }

    Return Value

    the last time the object was accessed. Nil, if no date available. READ ONLY

  • Declaration

    Swift

    public var sdkInstance: RVP_Cocoa_SDK? { get }

    Return Value

    the SDK instance that “owns” this instance. READ ONLY

Public Instance Methods

  • This is the default initializer.

    Declaration

    Swift

    public init(sdkInstance inSDKInstance: RVP_Cocoa_SDK?, objectInfoData inData: [String : Any])

    Parameters

    sdkInstance

    REQUIRED (Can be nil) This is the SDK instance that “owns” this object. It may be nil for history instances.

    objectInfoData

    REQUIRED This is the parsed JSON data for this object, as a Dictionary. If it is empty, then this is considered a brand new object, and its ID will be zero, read and write will be set to 1, and it will be marked writeable. Additionally, nothing will be saved to the original data cache.

  • This accesses the raw original data. READ ONLY

    Declaration

    Swift

    public var myOriginalData: [String : Any] { get }
  • This accesses the raw current data.

    Declaration

    Swift

    public var myData: [String : Any] { get set }
  • This reverts the data to the state before any changes were made.

    Declaration

    Swift

    public func revert()
  • This handles sending our data (if necessary) to the server.

    Declaration

    Swift

    public func sendToServer(refCon inRefCon: Any?)

    Parameters

    refCon

    This is an optional Any parameter that is simply returned after the call is complete. “refCon” is a very old concept, that stands for “Reference Context.” It allows the caller of an async operation to attach context to a call.

  • This deletes the object from the server (if the current login has permission). The base class simply sends a basic delete.

    Declaration

    Swift

    public func delete(refCon inRefCon: Any?)

    Parameters

    refCon

    This is an optional Any parameter that is simply returned after the call is complete. “refCon” is a very old concept, that stands for “Reference Context.” It allows the caller of an async operation to attach context to a call.

Public Sequence Protocol Methods, Typedefs and Structs

  • This is the element type for the Sequence protocol.

    Declaration

    Swift

    public typealias Element = Any?
  • We have a subscript to return values, as if we were directly accessing the data. READ ONLY. This returns the “asDictionary” response, as opposed to direct “myData” access (use “myData” for that).

    Declaration

    Swift

    public subscript(inKey: String) -> Element? { get }
  • This is the Sequence Iterator Struct. This iterates the “asDictionary” response. READ ONLY.

    See more

    Declaration

    Swift

    public struct Iterator : IteratorProtocol
  • Declaration

    Swift

    public func makeIterator() -> A_RVP_Cocoa_SDK_Object.Iterator

    Return Value

    a new iterator for the instance, which iterates the asDictionary response.It is read-only.