Skip to content

Instantly share code, notes, and snippets.

View iAmVishal16's full-sized avatar
πŸ’»
SwiftUI

Vishal Paliwal iAmVishal16

πŸ’»
SwiftUI
View GitHub Profile
@iAmVishal16
iAmVishal16 / CustomBottomSheet.swift
Created April 9, 2025 08:53
Sheet is always visible and not dismissible. Background buttons & text field remain interactive. Works with dynamic sheet sizing (small & medium heights).
import SwiftUI
struct HomeView: View {
@State private var isSheetPresented = true
@State private var textInput: String = ""
@State private var tapCount = 0
var body: some View {
ZStack {
Color.purple
@iAmVishal16
iAmVishal16 / LinkedList.swift
Created January 1, 2025 15:05
LinkedList Demonstration in Swift
class Node {
var value: Int
var next: Node?
init(value: Int, next: Node?) {
self.value = value
self.next = next
}
convenience init(value: Int) {
@iAmVishal16
iAmVishal16 / Operations.swift
Created September 4, 2024 18:24
Example of Associated types in Swift Protocols
protocol Operations {
associatedtype ItemType
func operation(arg1: ItemType, arg2: ItemType) -> ItemType
}
struct MathAddition: Operations {
func operation(arg1: Int, arg2: Int) -> Int {
return arg1 + arg2
}
}
@iAmVishal16
iAmVishal16 / HCardsScrollView.swift
Created March 24, 2024 17:19
Unlocking SwiftUI ScrollView Paging: Dual Scroll View Sync Mechanisms
import SwiftUI
struct HCardsScrollView: View {
let colorSets: [Color] = [
.red, .green, .blue,
.yellow, .purple, .pink,
.accentColor, .black, .brown,
.cyan, .indigo, .teal,
.orange, .mint
@iAmVishal16
iAmVishal16 / Spiral.swift
Created October 27, 2023 14:39
Rainbow Spiral in SwiftUI. Use apple Playground app for best result.
//
// Spiral.swift
// ShapeAnimation
//
// Created by Vishal Paliwal on 27/06/23.
//
import SwiftUI
struct SpiralView: View {
@iAmVishal16
iAmVishal16 / SnapCarouselView.swift
Last active June 7, 2024 03:17
Snap Card Carousel using DragGesture In SwiftUI
import SwiftUI
/*:
For more information, see [Simplest Snap Card Carousal In SwiftUI.](https://medium.com/@iamvishal16/simplest-snap-card-carousal-in-swiftui-e6a4395d487b)
*/
struct SnapCarouselView: View {
@State private var currentIndex: Int = 0
let cards: [Card] = [
//
// CirclesView.swift
// ShapeAnimation
//
// Created by Vishal Paliwal on 04/04/23.
//
import SwiftUI
struct CirclesView: View {
//
// ContentView.swift
// ShapesFun
//
// Created by Vishal Paliwal on 09/04/23.
//
import SwiftUI
struct ContentView: View {
//
// OptimisedTriangleAnim.swift
// ShapesFun
//
// Created by Vishal Paliwal on 22/01/23.
//
import SwiftUI
struct OptimisedTriangleAnim: View {
//
// MultiTriangleAnimView.swift
// ShapesFun
//
// Created by Vishal Paliwal on 09/04/23.
//
import SwiftUI
struct MultiTriangleAnimView: View {