Rewrite the presets system to add some additional options later.

This commit is contained in:
Damiano Galassi committed 2017-08-28 12:48:27 +02:00
1 parent 05f27e845a
commit f8c861df15
14 files changed
+350 -250

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
//
// Preset.swift
// Subler
//
// Created by Damiano Galassi on 21/08/2017.
//
import Foundation
@objc protocol Preset: AnyObject, NSSecureCoding {
var title: String { get }
var changed: Bool { get }
var version: Int { get }
var pathExtension: String { get }
}
extension Preset {
private func appSupportURL() -> URL? {
return FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first?.appendingPathComponent("Subler")
}
var fileURL: URL {
guard let url = appSupportURL() else { fatalError() }
return url.appendingPathComponent(title).appendingPathExtension(pathExtension)
}
}