Skip to content

Instantly share code, notes, and snippets.

View chriseidhof's full-sized avatar

Chris Eidhof chriseidhof

View GitHub Profile
import SwiftUI
final class Ticks: ObservableObject {
@Published var seconds: Int = 58
func start() {
Timer.scheduledTimer(withTimeInterval: 1, repeats: true, block: { [unowned self] _ in
withAnimation(.easeInOut) { self.seconds += 1 }
if self.seconds == 60 {
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + .milliseconds(350)) {
//
// ContentView.swift
// OrView
//
// Created by Chris Eidhof on 07.11.19.
// Copyright © 2019 Chris Eidhof. All rights reserved.
//
import SwiftUI
//
// ContentView.swift
// Bars
//
// Created by Chris Eidhof on 17.12.19.
// Copyright © 2019 objc.io. All rights reserved.
//
import SwiftUI
//
// Diagrams.swift
// DiagramsSample
//
// Created by Chris Eidhof on 16.12.19.
// Copyright © 2019 objc.io. All rights reserved.
//
import SwiftUI
struct Nested: View {
@State var counter = 0
init() {
print("Init")
}
var body: some View {
Button(action: { self.counter += 1 }, label: {
Text("Tap me! \(counter)")
})
}
@chriseidhof
chriseidhof / viewmirror.swift
Last active August 22, 2025 14:53
View Mirror
import SwiftUI
struct ContentView: View {
var body: some View {
HStack {
Text("Hello")
.padding()
.background(.blue)
.overlay {
Color.yellow
//
// ContentView.swift
// FlowLayoutST
//
// Created by Chris Eidhof on 22.08.19.
// Copyright © 2019 Chris Eidhof. All rights reserved.
//
import SwiftUI
struct FlowLayout {
//
// ContentView.swift
// OptionalViews
//
// Created by Chris Eidhof on 24.10.19.
// Copyright © 2019 objc.io. All rights reserved.
//
import SwiftUI
//
// ContentView.swift
// KeyFrameAnimation
//
// Created by Chris Eidhof on 21.10.19.
// Copyright © 2019 objc.io. All rights reserved.
//
import SwiftUI
//
// ContentView.swift
// Shake
//
// Created by Chris Eidhof on 01.10.19.
// Copyright © 2019 Chris Eidhof. All rights reserved.
//
import SwiftUI