LaunchEnvironmentResource

public struct LaunchEnvironmentResource

Stores resource as a name of the resource and Bundle in which the resource is available.

Resource is initialized with a bundle description (a bundle name or a bundle identifier) and a name of the resource. If bundle name is nil then Bundle.main is used.

Resource can be parsed from string.

Resources representation: is made of resource representation separated by comma. In addition, the CleanFlag can be used as first element.

Resource representation: is made of a bundle name (or a bundle identifier) and a resource name separated with colon. Bundle name can be a nil string then the Bundle.main will be used.

Example:

Test data:events,nil:contacts
AM_CLEAN_DATA_FLAG,Test data:events,nil:contacts
  • Clean flag indicating that existing data should be removed (eg. contacts) before adding new one.

    Declaration

    Swift

    public static let CleanFlag: String
  • Bundle object where resource is available.

    Declaration

    Swift

    public let bundle: Bundle
  • Resource name.

    Declaration

    Swift

    public let name: String
  • Initialize the resource with a bundle description (a bundle name or a bundle identifier) and a name of the resource.

    Declaration

    Swift

    public init?(bundle bundleDescription: String?, name: String)

    Parameters

    bundleDescription

    Bundle name or bundle identifier. If nil Bundle.main will be used.

    name

    Name of the resource.

    Return Value

    nil if cannot find a bundle with given name or identifier.

  • Parse resource from string.

    String representation is made of a bundle name (or a bundle identifier) and a resource name separated with colon. Bundle name can be a nil string then the Bundle.main will be used.

    Example:

    Test data:events
    nil:contacts
    

    Declaration

    Swift

    public static func resource(from resourceString: String) -> LaunchEnvironmentResource?

    Parameters

    resourceString

    String representation of the resource.

    Return Value

    nil if cannot find a bundle with given name or identifier.

  • Parse resources from string.

    String representation is made of resource representation separated by comma. In addition, the CleanFlag can be used as first element.

    Resource representation: is made of a bundle name (or a bundle identifier) and a resource name separated with colon. Bundle name can be a nil string then the Bundle.main will be used.

    Example:

    Test data:events,nil:contacts
    AM_CLEAN_DATA_FLAG,Test data:events,nil:contacts
    

    Declaration

    Swift

    public static func resources(from resourcesString: String) -> ([LaunchEnvironmentResource], Bool)

    Parameters

    resourcesString

    String representation of the resources.

    Return Value

    List of resources and clean flag.