Skip to content

Instantly share code, notes, and snippets.

View neilsmithdesign's full-sized avatar

Neil Smith neilsmithdesign

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