Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Eidhof chriseidhof

View GitHub Profile
View picker.swift
import SwiftUI
let items = ["Basic", "Advanced", "Ultra"]
struct ContentView: View {
@State var value: Int = 0
var body: some View {
VStack {
Picker(selection: $value, label: Text("Mode:")) {
@chriseidhof
chriseidhof / Alt.swift
Last active Jul 13, 2020
matchedGeometryEffect experiments
View Alt.swift
//
// ContentView.swift
// Effects
//
// Created by Chris Eidhof on 13.07.20.
//
import SwiftUI
struct MyModifier: AnimatableModifier {
View tabs.swift
//
// ContentView.swift
// TabBar
//
// Created by Chris Eidhof on 13.07.20.
//
import SwiftUI
struct ContentView: View {
View alsobroken.swift
//
// ContentView.swift
// AddressBook
//
// Created by Chris Eidhof on 13.07.20.
//
import SwiftUI
final class Contact: ObservableObject, Identifiable {
View bug1.swift
//
// ContentView.swift
// Bug1
//
// Created by Chris Eidhof on 03.07.20.
//
import SwiftUI
struct ContentView: View {
View notesclone.swift
//
// ContentView.swift
// NotesClone
//
// Created by Chris Eidhof on 29.06.20.
//
import SwiftUI
@main
@chriseidhof
chriseidhof / ob-swiftui.el
Last active May 25, 2020 — forked from xenodium/ob-swiftui.el
Preview SwiftUI layouts using Emacs org blocks
View ob-swiftui.el
(use-package org
:hook ((org-mode . org-display-inline-images))
:config
(use-package ob
:bind (:map org-mode-map
("C-c C-c" . org-ctrl-c-ctrl-c))
:config
(use-package ob-swift
@chriseidhof
chriseidhof / wrapper.swift
Created May 21, 2020
NSBrowser Delegate Wrapper
View wrapper.swift
import Cocoa
// Insipired by http://dcandi.com/post/cocoa-filesystem-browser/
extension URL {
var isDirectory: Bool {
return (try? resourceValues(forKeys: [.isDirectoryKey]))?.isDirectory ?? false
}
var fileIcon : NSImage {
View boilerplate.swift
// Run any SwiftUI view as a Mac app.
import Cocoa
import SwiftUI
NSApplication.shared.run {
VStack {
Text("Hello, World")
.padding()
.background(Capsule().fill(Color.blue))
View TextAlert.swift
//
// ContentView.swift
//
// Created by Chris Eidhof on 20.04.20.
// Copyright © 2020 objc.io. All rights reserved.
//
import SwiftUI
import UIKit
You can’t perform that action at this time.