Swiftの基本的な概念について学び、データ競合のない並行コードを実現する方法を知りましょう。
従来、可変状態(mutable state)は、細心の注意を払い、実行時の同期によって手動で保護する必要がありました。
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
VStack { | |
TextSampleView(style: .foreground) | |
TextSampleView(style: .mint) | |
TextSampleView(style: linearGradient) | |
} | |
.font(.largeTitle) |
import SwiftUI | |
import Observation | |
struct ContentView: View { | |
@State private var model = MazeObject(width: 39, height: 39) | |
@State private var resetID = UUID() | |
@State private var disabled = false | |
var body: some View { | |
VStack { |
import RealityKit | |
import SwiftUI | |
struct GlowingSphere: View { | |
@State private var opacity: Float = 1.0 | |
@State private var isForward: Bool = false | |
var body: some View { | |
GeometryReader3D { proxy in | |
RealityView { content in |
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
ScrollView(.vertical) { | |
ForEach(0..<1000) { i in | |
RoundedRectangle(cornerRadius: 24) | |
.fill(.blue) | |
.frame(height: 100) | |
.padding(.horizontal) |
import RealityKit | |
import SwiftUI | |
import GameplayKit | |
struct MorphingSphereRealityView: View { | |
@State private var currentEntity: Entity? | |
@State private var morphFactor: Float = 0.0 | |
@State private var frameDuration: TimeInterval = 0.0 | |
@State private var lastUpdateTime = CACurrentMediaTime() | |
import SwiftUI | |
struct AnimatingMaskedMeshView: View { | |
let referenceDate: Date = .now | |
@State private var mainPosition: CGPoint = .zero | |
@State private var positions: [CGPoint] = [] | |
private let blurRadius = 20.0 | |
private let alphaThreshold = 0.875 |
Swiftの基本的な概念について学び、データ競合のない並行コードを実現する方法を知りましょう。
従来、可変状態(mutable state)は、細心の注意を払い、実行時の同期によって手動で保護する必要がありました。
import SwiftUI | |
struct ContentView: View { | |
@State var trigger = 0 | |
@State var text = sampeles[0] | |
var body: some View { | |
VStack(alignment: .leading, spacing: 12) { | |
HackerTextEffectView( | |
text: text, |
// | |
// SignatureAnimation.swift | |
// OpenSwiftUIAnimations | |
// | |
// Created by Amos Gyamfi on 11.5.2024. | |
// | |
import SwiftUI | |
struct SignatureAnimation: View { |
import SwiftUI | |
extension [Color] { | |
static func rainbow(hue: Double = 0, count: Int) -> Self { | |
(0..<count).map { i in | |
var value = hue + Double(i) / Double(count) | |
value -= floor(value) | |
return Color(hue: value, saturation: 1/4, brightness: 1) | |
} | |
} |