Skip to content

Instantly share code, notes, and snippets.

Chris Eidhof chriseidhof

Block or report user

Report or block chriseidhof

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View state-restoration.swift
struct Nested: View {
@State var counter = 0
init() {
print("Init")
}
var body: some View {
Button(action: { self.counter += 1 }, label: {
Text("Tap me! \(counter)")
})
}
View CV+ScrollView.swift
//
// ContentView.swift
// FlowLayoutST
//
// Created by Chris Eidhof on 22.08.19.
// Copyright © 2019 Chris Eidhof. All rights reserved.
//
import SwiftUI
struct FlowLayout {
View env.swift
//
// ContentView.swift
// OptionalViews
//
// Created by Chris Eidhof on 24.10.19.
// Copyright © 2019 objc.io. All rights reserved.
//
import SwiftUI
View keyframes.swift
//
// ContentView.swift
// KeyFrameAnimation
//
// Created by Chris Eidhof on 21.10.19.
// Copyright © 2019 objc.io. All rights reserved.
//
import SwiftUI
View shake.swift
//
// ContentView.swift
// Shake
//
// Created by Chris Eidhof on 01.10.19.
// Copyright © 2019 Chris Eidhof. All rights reserved.
//
import SwiftUI
View animationcurves.swift
//
// ContentView.swift
// AnimationTimingCurve
//
// Created by Chris Eidhof on 25.09.19.
// Copyright © 2019 Chris Eidhof. All rights reserved.
//
import SwiftUI
View hello.swift
struct ContentView: View {
@State var prop: Bool = true
var body: some View {
VStack {
Rectangle()
.fill(prop ? Color.red : Color.green)
.frame(width: prop ? 100 : 300, height: prop ? 50 : 200)
.animation(.linear)
Spacer()
Toggle(isOn: $prop, label: { Text("Toggle") })
View collectionview.swift
//
// ContentView.swift
// CollectionView
//
// Created by Chris Eidhof on 20.08.19.
// Copyright © 2019 Chris Eidhof. All rights reserved.
//
import SwiftUI
View objcioarrow.swift
//
// ContentView.swift
// SwiftTalkAnimationLoader
//
// Created by Chris Eidhof on 30.07.19.
// Copyright © 2019 Chris Eidhof. All rights reserved.
//
import SwiftUI
@chriseidhof
chriseidhof / routing.swift
Last active Aug 24, 2019
routing_attempt_n
View routing.swift
import Foundation
struct Episode: Codable { }
struct EpisodeDetail: Codable { }
// episodes.json returns an [Episode]
// /episodes/foo should be (String) -> EpisodeDetail
enum Either<A, B> {
case left(A)
You can’t perform that action at this time.