Skip to content

Instantly share code, notes, and snippets.

View chFlorian's full-sized avatar
🏂

Florian Schweizer chFlorian

🏂
View GitHub Profile
@zacwest
zacwest / ios-font-sizes.swift
Last active April 24, 2025 07:18
iOS default font sizes - also available on https://www.iosfontsizes.com
let styles: [UIFont.TextStyle] = [
// iOS 17
.extraLargeTitle, .extraLargeTitle2,
// iOS 11
.largeTitle,
// iOS 9
.title1, .title2, .title3, .callout,
// iOS 7
.headline, .subheadline, .body, .footnote, .caption1, .caption2,
]
@caiobzen
caiobzen / Wave.swift
Created September 24, 2019 15:55
Wave view SwiftUI
import SwiftUI
struct Wave: Shape {
let graphWidth: CGFloat
let amplitude: CGFloat
func path(in rect: CGRect) -> Path {
let width = rect.width
let height = rect.height
@IsaacXen
IsaacXen / README.md
Last active April 12, 2025 01:49
(Almost) Every WWDC videos download links for aria2c.
@dabodamjan
dabodamjan / MailComposeViewController.swift
Last active April 24, 2024 07:31
Sending a contact us email on iOS 14 (can be also used with SwiftUI)
//
// Feel free to use this code in your project.
// Inspired by SO answer https://stackoverflow.com/a/65743126
// Uses DeviceKit as a dependency https://github.com/devicekit/DeviceKit
//
import Foundation
import MessageUI
import DeviceKit
//
// DebugPrint.swift
// Deep Links Test
//
// Created by Stewart Lynch on 2021-02-09.
//
import Foundation
enum DebugPrint {
@rileytestut
rileytestut / ExportIPA.swift
Last active February 3, 2025 19:53
Export Swift Playgrounds .ipa
import Foundation
// Export running app as .ipa, then return path to exported file.
// Returns String because app crashes when returning URL from async function for some reason...
func exportIPA() async throws -> String
{
// Path to app bundle
let bundleURL = Bundle.main.bundleURL
// Create Payload/ directory
@ramzesenok
ramzesenok / CustomSwipeActions.swift
Created March 20, 2022 17:19
SwiftUI custom swipe actions cause there are none outside of the List
struct ContentView: View {
@State var titles = ["Cell #1", "Cell #2", "Cell #3", "Cell #4"]
var body: some View {
NavigationView {
ScrollView {
VStack(spacing: 0) {
ForEach(self.titles, id: \.self) { title in
HStack {
Text(title)
@phranck
phranck / PlatformVisibility.swift
Last active August 30, 2024 00:05
A Swift view modifier to handle visibility of views for specific platforms
import SwiftUI
public struct Platform: OptionSet {
public var rawValue: UInt8
public static let iOS = Platform(rawValue: 1 << 0)
public static let macOS = Platform(rawValue: 1 << 1)
public static let tvOS = Platform(rawValue: 1 << 2)
public static let watchOS = Platform(rawValue: 1 << 3)
public static let all: Platform = [.iOS, .macOS, .tvOS, .watchOS]
@bjhomer
bjhomer / cross-view-lines.swift
Last active November 5, 2022 05:31
Creating cross-view lines in SwiftUI
//
// ContentView.swift
// SwiftUIPlayground
//
// Created by BJ Homer on 4/26/21.
//
import SwiftUI
@BenLumenDigital
BenLumenDigital / index.html
Created November 24, 2023 09:35
Browser multi-window communication. Simple as it comes.
<html>
<body>
<div id="debug"></div>
</body>
<script>
// BroadcastChannel is a browser feature, it allows communication between windows
// Find out more here: https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API
const broadcastChannel = new BroadcastChannel("com.lumen.basketball");