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
class UserViewModel: ObservableObject { | |
@Published private(set) var userDetails = UserDetails() | |
func loadUserDetails() { | |
Task { | |
do { | |
userDetails = try await fetchUserData() | |
} catch { | |
showError(error) | |
} |
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
// | |
// LazyView.swift | |
// Grocers | |
// | |
// Created by Anand Nimje on 10/09/20. | |
// Copyright © 2020 Anscoder. All rights reserved. | |
// | |
import SwiftUI |
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
// | |
// UnwrapUtil.swift | |
// Grocers | |
// | |
// Created by Anand Nimje on 08/09/20. | |
// Copyright © 2020 Anscoder. All rights reserved. | |
// | |
import SwiftUI |
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
// | |
// GridStack.swift | |
// Grocers | |
// | |
// Created by Anand Nimje on 27/08/20. | |
// Copyright © 2020 Anscoder. All rights reserved. | |
// | |
import SwiftUI |
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
// | |
// FileUtility.swift | |
// TravelApp | |
// | |
// Created by Anand Nimje on 13/04/20. | |
// Copyright © 2020 Anand. All rights reserved. | |
// | |
import Foundation |
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
private protocol AnyOptional{ | |
var isNil: Bool { get } | |
} | |
extension Optional: AnyOptional{ | |
var isNil: Bool { self == nil } | |
} | |
@propertyWrapper |
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
class Box<T>{ | |
typealias Listener = (T) -> Void | |
var listener: Listener? | |
var value: T { | |
didSet{ | |
listener?(value) | |
} | |
} |
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
func asyncWork(){ | |
let northZone = DispatchQueue(label: "perform_task_with_team_north") | |
let southZone = DispatchQueue(label: "perform_task_with_team_south") | |
northZone.async { | |
for numer in 1...3{ print("North \(numer)") } | |
} | |
southZone.async { | |
for numer in 1...3{ print("South \(numer)") } | |
} |
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
func syncWork(){ | |
let northZone = DispatchQueue(label: "perform_task_with_team_north") | |
let southZone = DispatchQueue(label: "perform_task_with_team_south") | |
northZone.sync { | |
for numer in 1...3{ print("North \(numer)")} | |
} | |
southZone.sync { | |
for numer in 1...3{ print("South \(numer)") } | |
} |
NewerOlder