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
ornil
if file doesn’t exists.
-
Initialize
Bundle
with a bundle name or a bundle identifier. Ifnil
is passed, thenBundle.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
isnil
is used as parameter.