Skip to content

Instantly share code, notes, and snippets.

import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
TextSampleView(style: .foreground)
TextSampleView(style: .mint)
TextSampleView(style: linearGradient)
}
.font(.largeTitle)
@Koshimizu-Takehito
Koshimizu-Takehito / MazeObject.swift
Created July 7, 2024 04:38
穴掘り法(Aldous-Broder Algorithm)を使用した迷路生成ロジック
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 {
@Matt54
Matt54 / GlowingSphere.swift
Created June 30, 2024 12:26
A blend of many spheres with varying opacity and size fading in and out
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)
@Matt54
Matt54 / MorphingSphereRealityView.swift
Created June 20, 2024 23:49
A RealityView using a LowLevelMesh to produce a morphing sphere
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()
@Matt54
Matt54 / AnimatingMaskedMeshView.swift
Created June 13, 2024 12:21
An animating mesh gradient view with an animating mask
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
@stzn
stzn / The Swift Concurrency Migration Guide Data Race Safety.md
Last active July 5, 2024 21:33
Data Race Safety in The Swift Concurrency Migration Guide

データ競合安全

Swiftの基本的な概念について学び、データ競合のない並行コードを実現する方法を知りましょう。

原文 https://github.com/apple/swift-migration-guide/blob/main/Guide.docc/DataRaceSafety.md
更新日 2024/7/6(翻訳を最後に更新した日付)
ここまで反映 https://github.com/apple/swift-migration-guide/commit/24e31ffc589fefb42f08877878e689eb29b1644b

従来、可変状態(mutable state)は、細心の注意を払い、実行時の同期によって手動で保護する必要がありました。

@Koshimizu-Takehito
Koshimizu-Takehito / 33869900928a99144c822c901d370352e539a895ed12420a0cc7080b866f0b75.swift
Last active December 30, 2024 20:52
Hacker Text Effect - SwiftUI - iOS 16 & iOS 17
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)
}
}