Bundle
public extension Bundle
-
Получаем файл с устройства
struct Example: Codable { var name = "Pall" } func getFileWith(name: String) { let example = Bundle.main.decode(Example.self, from: name) // do something }
Declaration
Swift
func decode<T>(_: T.Type, from file: String) -> T where T : Decodable
Parameters
file
Имя файла, из которого будем извлекать дату
Return Value
Тип, ограниченный протоколом Decodable