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
import UIKit | |
//It basically just gets image from assets, saves its data to disk and return file URL. | |
class AssetExtractor { | |
static func createLocalUrl(forImageNamed name: String) -> URL? { | |
let fileManager = FileManager.default | |
let cacheDirectory = fileManager.urls(for: .cachesDirectory, in: .userDomainMask)[0] | |
let url = cacheDirectory.appendingPathComponent("\(name).png") |
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
import Foundation | |
import SceneKit | |
class ARQLThumbnailGenerator { | |
private let device = MTLCreateSystemDefaultDevice()! | |
/// Create a thumbnail image of the asset with the specified URL at the specified | |
/// animation time. Supports loading of .scn, .usd, .usdz, .obj, and .abc files, | |
/// and other formats supported by ModelIO. |
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
let seconds = 86400*4 + 3600*2 + 65 | |
print(String((seconds / 86400)) + " days") | |
print(String((seconds % 86400) / 3600) + " hours") | |
print(String((seconds % 3600) / 60) + " minutes") | |
print(String((seconds % 3600) % 60) + " seconds") |
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
/* | |
You need to import EventKit | |
import EventKit | |
*/ | |
@IBAction func buttonCalendar(sender: AnyObject) { | |
var eventStore : EKEventStore = EKEventStore() | |
// 'EKEntityTypeReminder' or 'EKEntityTypeEvent' |