12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- //
- // TSUserDefaultData.swift
- // AIRingtone
- //
- // Created by 100Years on 2025/3/5.
- //
- import ObjectMapper
- //海报历史记录
- class TSPosterHistory{
- @UserDefault(key: "kPosterTextPicHistoryListString", defaultValue: "")
- static private var historyString: String
- static var listModelArray: [TSGeneralPicModel] = {
- if let listModelArray = Mapper<TSGeneralPicModel>().mapArray(JSONString: historyString){
- return listModelArray
- }
- return []
- }()
-
- static func saveModel(model:TSGeneralPicModel){
- listModelArray.insert(model, at: 0)
- if let jsonString = listModelArray.toJSONString() {
- historyString = jsonString
- }
- }
- }
- //头像历史记录
- class TSPhotoHistory{
- @UserDefault(key: "kPhotoTextPicHistoryListString", defaultValue: "")
- static private var historyString: String
- static var listModelArray: [TSGeneralPicModel] = {
- if let listModelArray = Mapper<TSGeneralPicModel>().mapArray(JSONString: historyString){
- return listModelArray
- }
- return []
- }()
-
- static func saveModel(model:TSGeneralPicModel){
- listModelArray.insert(model, at: 0)
- if let jsonString = listModelArray.toJSONString() {
- historyString = jsonString
- }
- }
- }
|