Skip to content

Instantly share code, notes, and snippets.

View kirti-swiggy's full-sized avatar
:dependabot:
tch tch

Kirti Verma kirti-swiggy

:dependabot:
tch tch
View GitHub Profile
// The SwiftUI Lab
// Website: https://swiftui-lab.com
// Article: https://swiftui-lab.com/alignment-guides
import SwiftUI
class Model: ObservableObject {
@Published var minimumContainer = true
@Published var extendedTouchBar = false
@Published var twoPhases = true
@kirti-swiggy
kirti-swiggy / Xcode14BuildStuckFix.md
Last active February 7, 2025 13:51
Fix for Xcode 14 getting stuck while rebuilding on macOS Ventura (13)

The Problem

The latest addition to Xcode's long list of bugs is the problem of Simulator screen going black and getting stuck. We need to manually kill the simulator and rebuild the project. This gets really frustrating if your project has significant build time.

The Workaround

You may follow following steps as a workaround till Apple fixes the issue in upcoming Xcode releases.

@kirti-swiggy
kirti-swiggy / VisibilityModifier.swift
Created February 6, 2023 10:33
ViewModifier to track when the View is visible if it's embedded in ScrollView.
struct VisibilityModifier: ViewModifier{
let positionOffset : Double
let height = UIScreen.main.bounds.height
func body(content: Content) -> some View {
GeometryReader { geometry in
let position = geometry.frame(in: CoordinateSpace.global).midY
ZStack {
Color.clear
if height >= (position + positionOffset) {
@kirti-swiggy
kirti-swiggy / OfferCarouselView.swift
Last active February 5, 2023 15:31
A horizontal carousel view in SwiftUI with automatic and manual scroll support. Created using TabView.
//
// OfferCarousalView.swift
// Playground
//
// Created by Kirti Kumar Verma on 04/01/23.
//
import Combine
import Kingfisher
import SwiftUI