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 Swift | |
public struct Color: Sendable { | |
/// The red component of the color. | |
/// | |
/// This property is not part of the public interface of the testing | |
/// library as we may wish to support non-RGB color spaces in the future. | |
internal var redComponent: UInt8 | |
/// The green component of the color. |
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 extension View { | |
func pinned<T: Hashable>(id: Binding<T?>) -> some View { | |
modifier(Pinned(pinnedId: .init( | |
get: { id.wrappedValue }, | |
set: { id.wrappedValue = $0 as? T } | |
))) | |
} | |
} |
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 Swift | |
extension Sequence { | |
/// Returns the number of elements matching the closure predicate. | |
/// | |
/// The `isIncluded` closure is called sequentially comparing each | |
/// element to determine the number of matches found. | |
/// This example shows how to find the number of elements matching | |
/// the given predicate. | |
/// |
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 | |
extension Mirror { | |
func printRecusively() { | |
for child in children { | |
let label = child.label ?? "<unknown>" | |
let value = child.value | |
print(type(of: value), label, value, separator: " | ") | |
Mirror(reflecting: value) |
This file has been truncated, but you can view the full file.
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
// swift-interface-format-version: 1.0 | |
// swift-compiler-version: Apple Swift version 5.9.2 (swiftlang-5.9.2.2.11 clang-1500.1.0.2.2) | |
// swift-module-flags: -target arm64e-apple-macos14.2 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -Osize -library-level api -library-level api -module-name SwiftUI | |
// swift-module-flags-ignorable: -enable-bare-slash-regex -user-module-version 5.2.12 | |
import Accessibility | |
import AppKit | |
import Combine | |
import CoreData | |
import CoreFoundation | |
@_exported import CoreGraphics |
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 Mirror { | |
func printRecusively() { | |
for child in children { | |
let label = child.label ?? "<unknown>" | |
let value = child.value | |
print(type(of: value), label, value, separator: " | ") | |
Mirror(reflecting: value) | |
.printRecusively() | |
} |
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 extension View { | |
func variadic<R: View>(@ViewBuilder _ transform: @escaping (_VariadicView.Children) -> R) -> some View { | |
_VariadicView.Tree(Helper(transform: transform)) { self } | |
} | |
} | |
private struct Helper<R: View>: _VariadicView.MultiViewRoot { | |
var transform: (_VariadicView.Children) -> R |
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 Divided<Content: View, Separator: View>: View { | |
var content: Content | |
var separator: Separator | |
public init(@ViewBuilder content: () -> Content, @ViewBuilder separator: () -> Separator) { | |
self.content = content() | |
self.separator = separator() | |
} |
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 extension View { | |
func padding(_ edges: Edge.Set = .all, scaled length: Length) -> some View { | |
modifier(PaddingModifier(edges: edges, padding: length.rawValue)) | |
} | |
func padding(scaled length: Length) -> some View { | |
modifier(PaddingModifier(edges: .all, padding: length.rawValue)) | |
} |