Skip to content

Instantly share code, notes, and snippets.

Avatar

Neil Smith neilsmithdesign

View GitHub Profile
@neilsmithdesign
neilsmithdesign / swift-ui-protocol-view-models.swift
Last active Oct 25, 2022
SwiftUI views with protocol interfaces to view models.
View swift-ui-protocol-view-models.swift
import SwiftUI
/// View model protocol
protocol ViewModel: ObservableObject {
var count: Int { get }
func increase()
}
/// Concrete implementation
class MyViewModel: ViewModel {