Skip to content

Instantly share code, notes, and snippets.

View levochkaa's full-sized avatar
👽

Lev Poznyakov levochkaa

👽
View GitHub Profile
@levochkaa
levochkaa / Observable.swift
Created January 25, 2024 15:24
Examples of View redrawing in SwiftUI
@Observable
class VM {
var counter = 0
}
struct ContentView: View {
@State var vm = VM()
var body: some View {
// doesn't get executed on button tap
@levochkaa
levochkaa / MapView.swift
Created February 5, 2024 10:41
touchesBegan/touchesEnded for Apple's MKMapView in SwiftUI
import SwiftUI
import MapKit
struct ContentView: View {
@State var region = MKCoordinateRegion()
@State var touching = false
var body: some View {
MapView(
region: $region,
@levochkaa
levochkaa / AXError.swift
Created April 3, 2025 11:06
Wrapper around AXUI and attempts to get/set active UITextView text
// AXError.swift
import Cocoa
extension AXError {
var string: String {
switch self {
case .success: "success"
case .failure: "failure"
case .illegalArgument: "illegalArgument"