以下のように構造体を作成してから、
Constant.swift
struct K {
struct UserDefaultsKey {
static let Settings = "kSetings"
}
struct NotificationKey {
static let Welcome = "kWelcomeNotif"
}
struct Path {
static let Documents = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] as String
static let Tmp = NSTemporaryDirectory()
}
}
以下のように使うだけ。
K.UserDefaultsKey.Settings
K.Path.Documents