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
func getUserDefaultsValueFromFile<T>(forKey key:String, type:T.Type) -> T? { | |
guard let bundleIdentifier = Bundle.main.bundleIdentifier else { | |
return nil | |
} | |
guard let libraryUrl = FileManager.default.urls(for: .libraryDirectory, in: .userDomainMask).first else { | |
return nil | |
} | |
let userDefaultsUrl = libraryUrl.appendingPathComponent("Preferences").appendingPathComponent(bundleIdentifier).appendingPathExtension("plist") | |
guard FileManager.default.fileExists(atPath: userDefaultsUrl.path) else { | |
return nil |
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 SwiftUI | |
import Combine | |
struct Todo:Codable { | |
let userId:Int | |
let id:Int | |
let title:String | |
let completed:Bool | |
} |
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 MultipeerConnectivity | |
class MCSessionAdapter:NSObject,MCSessionDelegate { | |
var session:MCSession? | |
weak var delegate:PeerSessionDelegate? | |
func setSession(_ session:MCSession) { | |
self.session = session |