Skip to content

Instantly share code, notes, and snippets.

@dkun7944
dkun7944 / ContentView.swift
Created July 31, 2023 03:36
AirDrop iOS 17 Swift.Shader Animation
//
// ContentView.swift
// Airdrop Demo
//
// Created by Daniel Kuntz on 7/30/23.
//
import SwiftUI
struct ContentView: View {
import SwiftUI
// https://gist.github.com/Koshimizu-Takehito/93c5891e89d65eadf2164351ca1f2d76
typealias ChartElement = (name: String, count: Int, color: Color)
struct AnimatedDonutChart: View {
@State private var progress: Double = 0
let data: [ChartElement]
@Koshimizu-Takehito
Koshimizu-Takehito / PhisicsLoadingView.swift
Last active July 22, 2023 03:34
おしゃれなローディングアニメーション
// Thanks to @Ren_yello
// https://twitter.com/ren_yello/status/1681856952090112000?s=61&t=SNv1ZCU_S3Y8TobPv4MBww
import SwiftUI
struct PhisicsLoadingView: View {
@State private var color: CGColor = .black
@State private var angle1: CGFloat = .pi/2
@State private var angle2: CGFloat = .pi/2
@State private var angle3: CGFloat = .pi/2
@renyello
renyello / ProgressRectangle.swift
Created July 20, 2023 06:10
四つの小さな円が正方形の角をサイズを変えながら移動します。
import SwiftUI
struct ProgressRectangle: View {
@State private var index = [0, 1, 2, 3]
@State private var scale: [CGFloat] = [1.0, 0.4, 1.0, 0.4] // Scale for each circle
let colors = [Color("Red"), Color("Green"), Color("Blue"), Color("Yellow")] // Colors for each circle
let minScale: CGFloat = 1.0 // Minimum scale value
let maxScale: CGFloat = 2.0 // Maximum scale value
@State private var opacity = 1.0
@Koshimizu-Takehito
Koshimizu-Takehito / LoadingSquares.swift
Last active July 19, 2023 23:03
おしゃれなローディングアニメーション
// Thanks to @Ren_yello
// https://twitter.com/ren_yello/status/1681556136682741762?s=61&t=SNv1ZCU_S3Y8TobPv4MBww
import SwiftUI
struct ContentView: View {
var body: some View {
LoadingSquares()
}
}
@Koshimizu-Takehito
Koshimizu-Takehito / LoadingCircles.swift
Created July 18, 2023 23:40
おしゃれなローディングアニメーション
import SwiftUI
// Thanks to @Ren_yello
// https://twitter.com/ren_yello/status/1681135824145113089?s=61&t=Z69bUaia8ogjDHp-N7Xvvg
struct ContentView: View {
@State var ratio: Double = 0
@State var angle: CGFloat = 0
@State var delta: CGFloat = 0
var body: some View {
@Koshimizu-Takehito
Koshimizu-Takehito / SegmentedControl.swift
Created July 17, 2023 09:52
カスタムなセグメントコントロール
import SwiftUI
struct ContentView: View {
@State var selectedIndex = 0
let options = ["Apple", "Orange", "Muscat"]
let colors: [Color] = [.red, .orange, .green]
var body: some View {
VStack {
SegmentedControl(selectedIndex: $selectedIndex, options: options, colors: colors)
@shirakaba
shirakaba / Creating an Expo app in 2023.md
Created July 12, 2023 08:08
Creating an Expo app in 2023

Creating an Expo app in 2023

12th July, 2023. I'm going to try creating an iOS app called Paranovel, using Expo. My environment for mobile app dev (Xcode, Ruby, etc.) should be in reasonably good shape already as I frequently develop with React Native and NativeScript.

Creating the app

Go to https://docs.expo.dev, and see the Quick Start: npx create-expo-app paranovel

This runs with no problem, then I get this macOS system popup:

import SwiftUI
struct RepeatingViews: View {
@State private var disappearEast: Bool = false
@State private var appearEast: Bool = false
@State private var moveEast: Bool = false
@State private var disappearSugarBeet: Bool = false
@State private var appearSugarBeet: Bool = false
@State private var moveSugarBeet: Bool = false
@alexwidua
alexwidua / ContentView.swift
Created July 4, 2023 17:07
SwiftUI Grid Animation
import SwiftUI
// 1. Use looped H/VStacks to create a grid
// 2. Conditionally increase spacing to grow/shrink the grid
// 3. Calculate the distance of each dot to the center and use the value to stagger the animation
//4. Add random delay on top of the staggered delay value
struct ContentView: View {
// const & state