Skip to content

Instantly share code, notes, and snippets.

View notoroid's full-sized avatar

Kaname Noto notoroid

View GitHub Profile
import SwiftUI
import Combine
// original code for CancellerWrapper was posted on @Cockscomb cockscomb's blog post. https://cockscomb.hatenablog.com/entry/2021/09/26/103128
class CancellerWrapper<Wrapped> {
var value: Wrapped
init(_ value: Wrapped) { self.value = value }
}
class SimpleModel: UIResponder, ObservableObject {
import SwiftUI
import Foundation
import CoreLocation
import Combine
class LocationManager: ObservableObject {
enum LocationManagerError: Error, LocalizedError {
case deniedLocation; case restrictedLocation; case unknown
var errorDescription: String? {
switch self {
import SwiftUI
import UserNotifications
#if os(iOS)
class AppDelegate : UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
registerForPushNotifications()
UNUserNotificationCenter.current().delegate = self
return true
}