Skip to content

Instantly share code, notes, and snippets.

View chriseidhof's full-sized avatar

Chris Eidhof chriseidhof

View GitHub Profile
//
// ContentView.swift
// WeatherWidget
//
// Created by Chris Eidhof on 20.01.21.
//
import SwiftUI
struct MyGuide: AlignmentID {
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 July 13, 2020 15:12
matchedGeometryEffect experiments
//
// ContentView.swift
// Effects
//
// Created by Chris Eidhof on 13.07.20.
//
import SwiftUI
struct MyModifier: AnimatableModifier {
//
// ContentView.swift
// TabBar
//
// Created by Chris Eidhof on 13.07.20.
//
import SwiftUI
struct ContentView: View {
//
// ContentView.swift
// AddressBook
//
// Created by Chris Eidhof on 13.07.20.
//
import SwiftUI
final class Contact: ObservableObject, Identifiable {
@chriseidhof
chriseidhof / bug1.swift
Created July 3, 2020 10:48
SwiftUI bugs
//
// ContentView.swift
// Bug1
//
// Created by Chris Eidhof on 03.07.20.
//
import SwiftUI
struct ContentView: View {
//
// ContentView.swift
// NotesClone
//
// Created by Chris Eidhof on 29.06.20.
//
import SwiftUI
@main
@chriseidhof
chriseidhof / ob-swiftui.el
Last active May 25, 2020 23:56 — forked from xenodium/ob-swiftui.el
Preview SwiftUI layouts using Emacs org blocks
(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 11:05
NSBrowser Delegate Wrapper
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 {
// 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))