Skip to content

Instantly share code, notes, and snippets.

View Pyroh's full-sized avatar
💭
I may be slow to respond.

Pierre TACCHI Pyroh

💭
I may be slow to respond.
View GitHub Profile
@Pyroh
Pyroh / purple-scroll-inset.swift
Created March 25, 2022 16:18 — forked from christianselig/purple-scroll-inset.swift
Trying to replicate an inset scroll view effect in SwiftUI
import SwiftUI
struct ContentView: View {
struct HeightPreferenceKey: PreferenceKey {
let heigh: Anchor<CGRect>?
static func reduce(value: inout Anchor<CGRect>?, nextValue: () -> Anchor<CGRect>?) {
value = nextValue()
}
}
@Pyroh
Pyroh / KeyCommand.swift
Created February 3, 2021 11:45 — forked from steipete/KeyCommand.swift
Add Keyboard Shortcuts to SwiftUI on iOS 13 when using `UIHostingController`. See https://steipete.com/posts/fixing-keyboardshortcut-in-swiftui/
//
// KeyCommand.swift
// Adds Keyboard Shortcuts to SwiftUI on iOS 13
// See https://steipete.com/posts/fixing-keyboardshortcut-in-swiftui/
// License: MIT
//
// Usage: (wrap view in `KeyboardEnabledHostingController`)
// Button(action: {
// print("Button Tapped!!")
// }) {