The FMPScheme class is used to work with a resources scheme.
class FMPScheme
Property | Description |
database |
Database. var database: FMPDatabase { get } |
Method | Description |
download(completion:) |
Get resources from server. It requests scheme of available resources from server and automatically creates tables required for storing the scheme in the database. After the resources scheme is loaded, it will be automatically written to the specified database. func download(completion: @escaping FMPRequestResponseHandler) Parameters:
|
getResources() | Get list of database resources. func getResources() -> [FMPResource]? |
copy() | Get instance of builder class for copying FMPScheme. It returns the instance of the FMPScheme.Builder builder class. func copy() -> FMPScheme.Builder |
Load resources scheme from server:
// Build an instance of the FMPScheme class. For details see examples for FMPScheme.Builder.
let scheme: FMPScheme = fmp.scheme.build()
// Load scheme of available resources.
scheme.download { (response) in
if response.success {
// Display server response
print(response.result)
} else {
// Display error code and description
print(response.error?.code, response.error?.description)
}
}
Get a list of available resources:
// Build an instance of the FMPScheme class. For details see examples for FMPScheme.Builder.
let scheme: FMPScheme = fmp.scheme.build()
// Get list of available resources
let resources: [FMPResource]? = scheme.getResources()
Copy FMPScheme:
// Build an instance of the FMPScheme class. For details see examples for FMPScheme.Builder.
let scheme: FMPScheme = fmp.scheme.build()
// Copy instance of the FMPScheme class.
let schemeCopy: FMPScheme = scheme.copy().build()
See also: