This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ShareSheetView.swift | |
// ScareSheet | |
// | |
// Created by Ryan Lintott on 2025-05-08. | |
// | |
import ShapeUp | |
import SwiftUI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You are a spymaster working for the BLUE TEAM. You will be presented with a list of words that both the BLUE TEAM and RED TEAM have. | |
You are trying to think of a one-word clue that relates to one or more of the words your team is trying to guess. | |
For example, if the word "nut" and "bark" is in your list, your one-word clue could be "tree", since both are found on trees. | |
When you have a good clue, you say it. You also say one number, which tells your teammates how many codenames are related to your clue. | |
You are allowed to give a clue for only one word, (e.g., "CASHEW, 1") but it's fun to try for multiple words. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import UIKit | |
public final class HostingView: UIView { | |
public init(@ViewBuilder content: () -> some View) { | |
super.init(frame: .zero) | |
let contentView = UIHostingConfiguration(content: content) | |
.margins(.all, 0) | |
.makeContentView() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Version of Swift 6 Mutex, with minimal API (just withLock), portable to at least iOS 15, probably much earlier. | |
// I cannot yet promise it's actually correct. | |
@frozen | |
public struct Mutex<Value> { | |
private let buffer: ManagedBuffer<Value, os_unfair_lock> | |
public init(_ initialValue: Value) { | |
buffer = ManagedBuffer<Value, os_unfair_lock>.create(minimumCapacity: 1) { _ in initialValue } | |
buffer.withUnsafeMutablePointerToElements { lockPtr in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private protocol SilenceDeprecationForUIScreenWindows { | |
var screens: [UIScreen] { get } | |
} | |
private final class SilenceDeprecationForUIScreenWindowsImplementation: SilenceDeprecationForUIScreenWindows { | |
@available(iOS, deprecated: 16) | |
var screens: [UIScreen] { UIScreen.screens } | |
} | |
extension UIScreen { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Blur.swift | |
// | |
// | |
// Created by Ethan Lipnik on 11/21/22. | |
// | |
import SwiftUI | |
private struct BlurModifier: ViewModifier { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CompareEquatableProperties.swift | |
// ListableUI | |
// | |
// Created by Kyle Van Essen on 7/28/22. | |
// | |
import Foundation | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import Foundation | |
// NOTE: This playground shows how to use Swift's AttributedString with Markdown. | |
// | |
// This code was used to display Markdown content in the Tot iOS Widget <https://tot.rocks> | |
// MARK: - Helpful Links | |
// NOTE: The following links helped me figure this stuff out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if DEBUG | |
/* | |
This fixes SwiftUI previews not rendering translucent materials correctly by | |
swizzling a couple of properties on NSWindow. | |
Just drop into your project and add to the target being previewed (or something it links against). | |
Notice the #if DEBUG, so this code won't end up in release builds. It also checks for the | |
XCODE_RUNNING_FOR_PREVIEWS environment variable so that it won't affect regular debug builds of the app. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Error { | |
var code: Int { return (self as NSError).code } | |
var domain: String { return (self as NSError).domain } | |
var userInfo: [String:Any] { return (self as NSError).userInfo } | |
func timeAfterWhichToRetry(retryCount: Int) -> TimeInterval? { | |
// CloudKit suggests us retry too often, so slow us down as we retry a lot, up to 5 minutes | |
if let suggestedTimeout = suggestedTimeAfterWhichToRetry { | |
if suggestedTimeAfterWhichToRetry == 0 { | |
return 0 |
NewerOlder