Skip to content

Instantly share code, notes, and snippets.

View hannesoid's full-sized avatar

Hannes Oud hannesoid

View GitHub Profile
@ryanlintott
ryanlintott / KeyboardButtonStyle.swift
Last active February 25, 2024 01:15
A SwiftUI ButtonStyle that looks like an iOS keyboard key.
//
// KeyboardButtonStyle.swift
// Wordhord
//
// Created by Ryan Lintott on 2024-02-06.
//
import ShapeUp
import SwiftUI
@manmal
manmal / ScrollViewThatFits.swift
Last active March 1, 2024 16:08
Wrap a SwiftUI View in a ScrollView, expanding to full height/width & preventing bouncing when possible (iOS > = 16.4)
import SwiftUI
/// Wraps the content in a ScrollView that only bounces
/// if the content size exceeds the visible area;
/// and makes the content fill the ScrollView if desired.
/// Per default, the content fills the ScrollView only
/// vertically.
///
/// Usage:
///
@simonbs
simonbs / SwiftUIHostingConfiguration.md
Last active September 6, 2025 09:18
In iOS 16, Apple added UIHostingConfiguration, making it straightforward to use a SwiftUI view in instances of UICollectionViewCell and UITableViewCell. This project shows how UIHostingConfiguration can be backported to iOS 14 by implementing a type that conforms to the UIContentConfiguration protocol.

SwiftUIHostingConfiguration

In iOS 16, Apple added UIHostingConfiguration, making it straightforward to use a SwiftUI view in instances of UICollectionViewCell and UITableViewCell. This gist shows how UIHostingConfiguration can be backported to iOS 14 by implementing a type that conforms to UIContentConfiguration.

Starting from iOS 16, we can use SwiftUI views in an instance of UICollectionView or UITableViewCell like this:

cell.contentConfiguration = UIHostingConfiguration {
    ExampleCellContentView(color: Color(item.color), text: item.text)
}
@ryanashcraft
ryanashcraft / xcodebuild-filter
Created July 31, 2025 18:20
xcodebuild-filter
#!/bin/bash
# xcodebuild-filter - Simplify xcodebuild output
# Usage: xcodebuild [args] | ./bin/xcodebuild-filter [--errors-only]
# Configuration
ERRORS_ONLY=false
# Parse arguments
for arg in "$@"; do
@LukasCZ
LukasCZ / LargeNavTitlesOniOS18Fixer.swift
Last active September 26, 2025 09:21
Fix for broken layout of large navigation titles when building with Xcode 26 and running on iOS 18.
//
// LargeNavTitlesOniOS18Fixer.swift
//
// Created by Lukas Petr on 30.08.2025.
// Licensed under the MIT License.
// See https://opensource.org/licenses/MIT for details.
//
//
// When compiling with Xcode 26 and running on iOS 18, large navigation titles have wrong layout (no leading margin).