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 | |
// MARK: - Demo Screen | |
/// A demo screen showcasing a custom color-based segmented control component. | |
/// Displays a list of segments and shows the selected segment's value in a large, bold title. | |
struct ColorSegmentedControlDemoScreen: View { | |
/// The static list of selectable segments. | |
private static let demoItems: [ColorItem] = [ | |
ColorItem(value: "Apple", color: .red), |
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 Observation | |
/// An observable view‑model that drives a numeric badge. | |
/// | |
/// `BadgeModel` keeps track of the current count (`number`) and the | |
/// badge’s visual appearance (`style`). It also exposes two derived | |
/// properties that make it easy to bind the model to SwiftUI controls: | |
/// | |
/// * `slider` – Bridges the `Int`‐based `number` to floating‑point | |
/// controls such as `Slider`. |
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 | |
// MARK: - Demo Screen | |
/// A sample screen demonstrating three stacked stroke effects produced by | |
/// `StrokeModifier`. | |
/// Each call to `.stroke(_:width:)` adds an additional blurred outline, | |
/// resulting in a multi-layered border. | |
struct StrokeModifierDemoScreen: View { | |
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
import SwiftUI | |
// MARK: - Demo Screen | |
/// Demonstrates `OrbitingDotsLoadingView` and lets you preview it at any | |
/// built-in `ControlSize`. | |
/// | |
/// The loader is centered, while the bottom `ControlSizePicker` writes | |
/// to `controlSize`, automatically propagating the value down the view | |
/// hierarchy through `.controlSize(_:)`. |
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 ContentView: View { | |
var body: some View { | |
TextShape(sample) | |
.fill(.orange) | |
.stroke(.blue, lineWidth: 2) | |
} | |
var sample: AttributedString { |
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 ContentView: View { | |
var body: some View { | |
GeometryReader { geometry in | |
let scrollViewFrame = geometry.frame(in: .local) | |
ScrollView { | |
ForEach(0..<1000) { offset in | |
RowContent(offset: offset, scrollViewFrame: scrollViewFrame) | |
} |
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 Combine | |
import Foundation | |
// MARK: - MazeGenerator (Model) | |
/// An actor that generates a maze using a depth-first search (DFS) based approach. | |
/// 深さ優先探索 (DFS) ベースのアルゴリズムを用いて迷路を生成する。 | |
/// | |
/// This actor provides an async stream of snapshots (`MazeGenerator.Snapshot`) so that observers | |
/// can track the maze's state and generation progress in real time. |
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 EnvironmentValues { | |
@Entry var customStringValue = "Goodbye, world!" | |
} | |
struct ContentView: View { | |
var body: some View { | |
RepRepresentable() | |
.environment(\.customStringValue, "Hello, world!") |
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 EnvironmentValues { | |
@Entry var myColor = Color.blue | |
} | |
struct ScreenX: View { | |
@Environment(\.myColor) var myColor: Color | |
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
import SwiftUI | |
// MARK: - ContentView | |
struct ContentView: View { | |
var body: some View { | |
MyForm() | |
.frame(maxHeight: .infinity, alignment: .top) | |
.padding() | |
.padding(.top) |
NewerOlder