This file contains hidden or 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 Cocoa | |
| // Say we have a Person model | |
| enum V1 { | |
| struct Person: Codable { | |
| let name: String | |
| var age: Int | |
| } | |
| } |
This file contains hidden or 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 SwiftUI | |
| extension Published:Decodable where Value:Decodable { | |
| public init(from decoder: Decoder) throws { | |
| let decoded = try Value(from:decoder) | |
| self = Published(initialValue:decoded) | |
| } | |
| } |
This file contains hidden or 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 UIKit | |
| extension UIApplication { | |
| func _handleNonLaunchSpecificActions(arg1: AnyObject, forScene arg2: AnyObject, withTransitionContext arg3: AnyObject, completion completionHandler: () -> Void) { | |
| //whatever you want to do in this catch | |
| print("handleNonLaunchSpecificActions catched") | |
| } | |
| } |
This file contains hidden or 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
| /* | |
| For this Gist, we have two sides: sender and receiver. The same user can be a sender and a receiver, but I will separate this | |
| two roles to be more clear. | |
| This gist assumes thatyou already have a MCSession created, and the peers are connected, | |
| */ | |