This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Device: Codable { | |
var name: String | |
var manufacturer: String | |
} | |
struct User: Encodable { | |
var name: String | |
var username: String | |
var phoneNumber: String | |
var devices: [Device] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Device: Codable { | |
var name: String | |
var manufacturer: String | |
} | |
struct User: Encodable { | |
var name: String | |
var username: String | |
var phoneNumber: String | |
var devices: [Device] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func decode(data: Data) throws -> User? { | |
do { | |
let decoder = JSONDecoder() | |
let user = try decoder.decode(User.self, from: data) | |
return user | |
} catch let error { | |
print(error) | |
return nil | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Device: Codable { | |
var name: String | |
var manufacturer: String | |
} | |
struct User: Codable { | |
var name: String | |
var username: String | |
var phoneNumber: String | |
var devices: [Device] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct User: Codable { | |
var name: String | |
var username: String | |
var phoneNumber: String | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct User { | |
var name: String | |
var username: String | |
var phoneNumber: String | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func compress(videoPath : String, exportVideoPath : String, renderSize : CGSize, completion : (Bool) -> ()) { | |
let videoUrl = NSURL(fileURLWithPath: videoPath) | |
if (!existsFileAtUrl(videoUrl)) { | |
completion(false) | |
return | |
} | |
let videoAssetUrl = AVURLAsset(URL: videoUrl, options: nil) | |
NewerOlder