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) |
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 { | |
@State var vertex = 6 | |
@State var roundness: Double = 0.5 | |
var body: some View { | |
ZStack { | |
Polygon(vertex: vertex, roundness: roundness) | |
.fill(gradient) |
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 { | |
CollisionAnimationView(speed: .init(dx: 100, dy: 140)) | |
} | |
} | |
struct CollisionAnimationView: View { | |
var speed: CGVector |
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 Star: Hashable, Identifiable { | |
var id = UUID() | |
var color: Color | |
var speed: Double | |
static var sun: Star { | |
Star(color: .red.mix(with: .orange, by: 0.2), speed: 1) | |
} |
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 { | |
@State private var image = UIImage() | |
@State private var buttonRect = CGRect() | |
@State private var isBrightBackground = false | |
@State private var viewID = UUID() | |
var body: some View { | |
NavigationStack { |
NewerOlder