Skip to content

Instantly share code, notes, and snippets.

View VAndrJ's full-sized avatar

VAndrJ VAndrJ

  • Ukraine
  • 21:40 (UTC +02:00)
View GitHub Profile
@VAndrJ
VAndrJ / NavigationStackRootMREApp.swift
Last active November 14, 2024 14:06
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):
@VAndrJ
VAndrJ / ContentView.swift
Created February 24, 2024 09:16
SwiftUI zIndex MRE
//
// ContentView.swift
// PosIndexMRE
//
// Created by VAndrJ on 24.02.2024.
//
import SwiftUI
struct ContentView: View {
@VAndrJ
VAndrJ / OnAppearCheck.swift
Created January 6, 2024 22:01
SwiftUI onAppear bug
//
// ContentView.swift
// OnAppearCheck
//
// Created by VAndrJ on 21.12.2023.
//
import SwiftUI
struct ContentView: View {
@VAndrJ
VAndrJ / swift_build_performance.py
Last active December 18, 2023 21:37
Swift built performance benchmark. Results using Xcode 14.3.1.
#!/usr/bin/env python3
import os
filenames = ["a", "b"]
code = [
'someFunc(SomeStruct(str: "Foo"))',
'someFunc(.init(str: "Foo"))'
]
for (i, filename) in enumerate(filenames):