Skip to content

Instantly share code, notes, and snippets.

@SoundBlaster
SoundBlaster / gist:05362e2ee026a524f2489483edcb777d
Last active April 22, 2021 07:38
Change Mac Catalyst SwiftUI app UISplitViewController background style to sidebar as in native Mac SwiftUI app
// Apple Forum Question https://developer.apple.com/forums/thread/129211?answerId=620460022#620460022
//
// SceneDelegate.swift
//
// Created by Egor Merkushev on 11.07.2020.
// Copyright © 2020 Egor Merkushev. All rights reserved.
//
import UIKit
import SwiftUI
@chriseidhof
chriseidhof / collectionview.swift
Last active January 31, 2024 19:00
SwiftUI Flow Layout
//
// ContentView.swift
// DeleteMe
//
// Created by Chris Eidhof on 02.02.21.
//
import SwiftUI
/*
@scottmatthewman
scottmatthewman / AdaptsToSoftwareKeyboard.swift
Last active April 19, 2024 12:56
An example of using Combine to automatically adapt a SwiftUI scrollable view to accommodate an iOS onscreen keyboard
import SwiftUI
import Combine
struct AdaptsToSoftwareKeyboard: ViewModifier {
@State var currentHeight: CGFloat = 0
func body(content: Content) -> some View {
content
.padding(.bottom, currentHeight)
.edgesIgnoringSafeArea(.bottom)
//
// ContentView.swift
// Layout
//
// Created by Matt Gallagher on 7/6/19.
// Copyright © 2019 Matt Gallagher. All rights reserved.
//
import SwiftUI
@Thomvis
Thomvis / SwiftUI-Circular.swift
Last active August 4, 2021 21:41
Rough attempt at creating a container view that lays out its children in a circle #SwiftUI
struct ContentView: View {
@State var count: Int = 3
var body: some View {
return NavigationView {
VStack(spacing: 50) {
HStack {
Button(action: { self.count += 1 }) {
Text("Add")
}