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 | |
struct XForm <Content>: View where Content: View { | |
let content: Content | |
init(@ViewBuilder content: () -> Content) { | |
self.content = content() | |
} | |
var body: some View { |
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
// A fix for https://github.com/AvdLee/TaskGroupsResultBuilder/blob/main/TaskGroups/TaskResultBuilder.swift | |
// to handle cancellation. | |
@resultBuilder | |
struct TaskBuilder { | |
static func buildExpression<Success: Sendable>(_ task: Task<Success, Never>) -> [Task<Success, Never>] { | |
[task] | |
} | |
static func buildBlock<Success: Sendable>(_ tasks: [Task<Success, Never>]...) -> [Task<Success, Never>] { |
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
// (c) Hannes Oud @hannesoid | |
/// Hosts a SwiftUI view for use as an`inputAccessoryView` | |
/// | |
/// - Implements a subclass of `UIInputViewController`, this allows setting it as `UITextView.inputAccessoryViewController` | |
/// - Has as a `.view` a `UIView` subclass that provides a `.intrinsicContentSize` which returns the height of a SwiftUI view | |
/// - Has a `UIHostingViewController` subclass as a child view controller. Invalidates the `.view`'s `intrinsicContentSize` when the SwiftUI view layouts, in order to inform the system to update the size of the `inputAccessoryView` | |
/// | |
/// **Usage** | |
/// |
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 | |
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] |
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
// | |
// App.swift | |
// | |
// Created by Ben Tindall on 30/03/2022. | |
// | |
import Foundation | |
import SwiftUI | |
import Cocoa |
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
/// MIT License | |
/// | |
/// Copyright (c) 2021 Lukas Kubanek, Structured Path GmbH | |
/// | |
/// Permission is hereby granted, free of charge, to any person obtaining a copy | |
/// of this software and associated documentation files (the "Software"), to deal | |
/// in the Software without restriction, including without limitation the rights | |
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
/// copies of the Software, and to permit persons to whom the Software is | |
/// furnished to do so, subject to the following conditions: |
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
// | |
// LRUCacheActor.swift | |
// LRUCacheActor | |
// | |
// Created by Eneko Alonso on 9/5/21. | |
// | |
import Foundation | |
import OrderedCollections |
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
struct ScrollViewOffsetPreferenceKey: PreferenceKey { | |
static var defaultValue: CGPoint = .zero | |
static func reduce(value: inout CGPoint, nextValue: () -> CGPoint) { | |
value = nextValue() | |
print("value = \(value)") | |
} | |
typealias Value = CGPoint |
NewerOlder