Skip to content

Instantly share code, notes, and snippets.

@Inncoder
Inncoder / ContentView.swift
Created October 2, 2024 20:29
Grid loading animation
import SwiftUI
struct ContentView: View {
@State private var animate: Bool = false
@State private var color: Color = .myGray
@State private var pattern: [[Int]] = [
[0, 1, 2, 3, 4, 5, 6, 7, 8,],
[9, 10, 11, 12, 13, 14, 15, 16, 17,],
[18, 19, 20, 21, 22, 23, 24, 24, 26,],
import UIKit
import SwiftUI
struct Fireworks: UIViewControllerRepresentable {
// 2.
func makeUIViewController(context: Context) -> FireworkViewController {
return FireworkViewController()
}
@Inncoder
Inncoder / CircleSpinLoading.swift
Created December 14, 2020 15:38
CircleSpinLoading
// Created by Inncoder.
// Copyright © 2020 Inncoder AS. All rights reserved.
//
import SwiftUI
struct CircleSpinLoading: View {
@State private var offset: CGFloat = 0
@State private var rotation: Double = 0
@Inncoder
Inncoder / Button.swift
Created December 6, 2020 11:19
Toggle button
// Created by Inncoder.
// Copyright © 2020 Inncoder AS. All rights reserved.
//
import SwiftUI
struct Button: View {
@State private var buttonSize: CGFloat = 0
@State private var buttonOffset: CGFloat = 0
@Inncoder
Inncoder / ShowPass.swift
Created December 2, 2020 21:48
Show/hide password
// Created by Inncoder.
// Copyright © 2020 Inncoder AS. All rights reserved.
import SwiftUI
struct ShowPass: View {
@State private var password = ""
@State private var showPass = false
struct ParticleEmitter {
static var rectangle: ParticlesEmitter {
get {
let base = EmitterCell()
.content(.circle(10))
.birthRate(20)
.lifetime(14)
.velocity(CGFloat(Int.random(in: 50...100)))
.velocityRange(0)
.emissionLongitude(10)
@Inncoder
Inncoder / NeumorphicToggle.swift
Created November 22, 2020 12:42
Neumorphic toggle button
// Created by Inncoder.
// Copyright © 2020 Inncoder AS. All rights reserved.
//
import SwiftUI
struct NeumorphicToggle: View {
@State private var toggled = false
@State private var animating = false
@Inncoder
Inncoder / Toggle.swift
Created November 18, 2020 23:17
darkmode toggle
//
// Toggle.swift
// Animations
//
// Created by Inncoder on 18/11/2020.
// Copyright © 2020 Inncoder AS. All rights reserved.
//
import SwiftUI
// Created by Inncoder on 15/11/2020.
// Copyright © 2020 Inncoder AS. All rights reserved.
//
import SwiftUI
struct ShuffleLoading: View {
@State private var offset: [CGFloat] = [0, 0, 0]
@State private var rotation: [Double] = [0, 0, 0]
@Inncoder
Inncoder / Hourglass.swift
Created November 9, 2020 23:23
Hourglass animation
struct Hourglass: View {
let hourglassSize: CGFloat
let glassColor: Color
let sandColor: Color
@State private var topOffset: CGFloat = 0
@State private var middleOffset: CGFloat = 0
@State private var bottomOffset: CGFloat = 0