Bundle

class Bundle : NSObject
  • Initialize Bundle with a bundle name or a bundle identifier.

    Declaration

    Swift

    public convenience init?(stringDescription: String?)

    Parameters

    stringDescription

    Bundle name or a bundle identifier.

    Return Value

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

  • Returns array from JSON file.

    Note

    The file has to have a json extension.

    Declaration

    Swift

    public func jsonArray<T>(with name: String) -> [T]?

    Parameters

    name

    JSON file name without extenstion.

    Return Value

    Array of objects, or nil if an error occurs.

  • Returns data from file.

    Declaration

    Swift

    public func data(with name: String) -> Data?

    Parameters

    name

    File name, with extension.

    Return Value

    File contents as Data or nil if file doesn’t exists.

  • Initialize Bundle with a bundle name or a bundle identifier. If nil is passed, then Bundle.main is returned.

    Declaration

    Swift

    public static func with(stringDescription description: String?) -> Bundle?

    Parameters

    description

    Bundle name, a bundle identifier or nil.

    Return Value

    nil if cannot find a bundle with given name or identifier. Bundle.main is nil is used as parameter.