SynthReel/SynthReel/Libs/SRDeviceID/SRDeviceId.swift
2025-11-20 16:59:32 +08:00

28 lines
621 B
Swift

//
// SRDeviceId.swift
// SynthReel
//
// Created by on 2025/11/12.
// Copyright © 2025 SR. All rights reserved.
//
import UIKit
class SRDeviceId {
static let shared = SRDeviceId()
private let key = "com.synthreel.deviceid"
// private init() {}
lazy var id: String = {
if let savedID = SRKeychain.shared.read(key: key) {
return savedID
} else {
let newID = UIDevice.current.identifierForVendor?.uuidString ?? UUID().uuidString
SRKeychain.shared.save(key: key, value: newID)
return newID
}
}()
}