Skip to content

Instantly share code, notes, and snippets.

View VAndrJ's full-sized avatar

VAndrJ VAndrJ

  • Ukraine
  • 10:50 (UTC +03:00)
View GitHub Profile
@VAndrJ
VAndrJ / HighPriorityGestureMRE.swift
Last active December 13, 2024 08:28
List scroll issue iOS 18+, Xcode 16+
struct ContentView: View {
@State private var translationWidth = 0.0
var body: some View {
VStack {
List(0...1000, id: \.self) {
Text("\($0)")
}
Text("\(translationWidth)")
.padding(16)
@VAndrJ
VAndrJ / SingletonActorMRE.swift
Created December 5, 2024 16:12
Swift 6 actor deinit issue.
import SwiftUI
struct ContentView: View {
var body: some View {
Button("increment") {
Task {
await CountActor.shared.increment()
}
}
}
@VAndrJ
VAndrJ / NavigationStackDestinationMRE.swift
Created November 22, 2024 08:01
isPresented navigationDestionation NavigationStack iOS 16 issue.
import SwiftUI
@main
struct NavigationStackIsPresentedMREApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
@VAndrJ
VAndrJ / NavigationStackRootMREApp.swift
Last active November 18, 2024 17:02
NavigationStack path clear issue on iOS 18.0+
import SwiftUI
@main
struct TestNavigationSearchApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
@VAndrJ
VAndrJ / InteractiveDismissMRE.swift
Created November 6, 2024 15:43
interactiveDismissDisabled issue.
import SwiftUI
struct ContentView: View {
@State private var isSheetPresented = false
var body: some View {
NavigationStack {
Button("Present sheet") {
isSheetPresented = true
}
@VAndrJ
VAndrJ / SplitMRE.swift
Created October 31, 2024 19:46
NavigationSplitView issue MRE.
import SwiftUI
@main
struct SplitMREApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
@VAndrJ
VAndrJ / SpreadsheetView.swift
Created August 16, 2024 13:34 — forked from natpenguin/SpreadsheetView.swift
A view like spreadsheet in SwiftUI
import SwiftUI
struct SpreadsheetView<ColumnView: View, RowView: View, ContentView: View, Column: Hashable, Row: Hashable>: View {
init(
columns: [Column],
rows: [Row],
columnWidth: CGFloat,
columnHeight: CGFloat,
rowWidth: CGFloat,
rowHeight: CGFloat,
@VAndrJ
VAndrJ / AlertModifierWithoutProblem.swift
Last active August 17, 2024 07:35
Alert close problem MRE.
import SwiftUI
@main
struct ExampleApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
@VAndrJ
VAndrJ / TestObservableBindableApp.swift
Created August 9, 2024 09:53
ObservableObject vs Observable vs State MRE
import SwiftUI
import Observation
@main
struct TestObservableBindableApp: App {
@State var observableObjectModel = ObservableObjectModel()
@State var observableModel = ObservableModel()
var body: some Scene {
WindowGroup {
@VAndrJ
VAndrJ / swift_compilation_performance.py
Created March 11, 2024 13:09
Swift compilation time benchmark
#!/usr/bin/env python3
import os
filenames = ["a", "b"]
codeMixed = [
'someFunc(data: SomeClass(data: SomeStruct(data: SomeStruct.Nested1.Nested2(point: CGPoint(x: {}, y: {})))))',
'someFunc(data: .init(data: .init(data: .init(point: .init(x: {}, y: {})))))'
]
for (i, filename) in enumerate(filenames):