Skip to content

Instantly share code, notes, and snippets.

View byaruhaf's full-sized avatar
🏄
Surfing Xcode

Franklin Byaruhanga byaruhaf

🏄
Surfing Xcode
View GitHub Profile
@bobdel
bobdel / Extension+Logger.swift
Last active October 5, 2024 18:45
General purpose global logging and signpost configuration file
//
// Extension+Logger.swift
//
// Created by Robert DeLaurentis on 3/13/24.
// Last Modified on 10/4/24.
// https://gist.github.com/bobdel/8baab707f7532fa61994a1718b96aa8f
///**
/// General purpose global logging and signpost configuration file
/// tested on Xcode 16, iOS 18, Swift 6 toolchain, and strict concurrency
@lienmt
lienmt / PurchaseManager.swift
Last active November 27, 2024 20:02
PurchaseManager with SwiftUI & StoreKit
import Foundation
import StoreKit
enum ProductsId: String {
case subsWeekly24 = "WeeklyId"
case subsAnnual24 = "AnnualId"
}
@MainActor
class PurchaseManager: NSObject, ObservableObject {
@stevdza-san
stevdza-san / RequestState.kt
Last active October 9, 2024 12:56
Useful wrapper class for handling the data in Jetpack Compose
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.togetherWith
import androidx.compose.runtime.Composable
sealed class RequestState<out T> {
data object Idle : RequestState<Nothing>()
data object Loading : RequestState<Nothing>()
@marcoarment
marcoarment / Searchable_iOS16.swift
Created July 11, 2023 19:23
Backporting iOS 17's SwiftUI .searchable($isPresented) binding for iOS 16
import SwiftUI
extension View {
public func searchable_iOS16(text: Binding<String>, isPresented: Binding<Bool>, placement: SearchFieldPlacement) -> some View {
modifier(Searchable_iOS16(text: text, isPresented: isPresented, placement: placement))
}
}
public struct Searchable_iOS16: ViewModifier {
@Binding var text: String
@BobbyESP
BobbyESP / libs.versions.toml
Created April 29, 2023 10:05
A very complete TOML file for Android Development mainly thought for the new Jetpack Compose framework
[versions]
accompanist = "0.29.2-rc"
androidGradlePlugin = "7.4.2"
androidxComposeBom = "2023.01.00"
androidxComposeCompiler = "1.4.6"
androidxCore = "1.10.0-rc01"
androidMaterial = "1.9.0-alpha02"
androidxAppCompat = "1.7.0-alpha02"
androidxActivity = "1.7.1"
markdownDependency = "0.3.2"
@yimajo
yimajo / Query+AsyncTrowingStream.swift
Created March 17, 2023 15:22
Wrap Firestore's addSnapshotListner method for use with AsyncThrowingStream.
import FirebaseFirestore
// MARK: - async
extension Query {
func addSnapshotListener<T>(
includeMetadataChanges: Bool = false
) -> AsyncThrowingStream<[T], Error> where T: Decodable{
.init { continuation in
let listener = addSnapshotListener(includeMetadataChanges: includeMetadataChanges) { result in
//
// CacheAsyncImage.swift
//
// Created by Costantino Pistagna on 08/02/23.
//
import SwiftUI
struct CacheAsyncImage<Content, Content2>: View where Content: View, Content2: View {
private let url: URL?
@yimajo
yimajo / Query+Result.swift
Created January 23, 2023 06:59
FirebaseFirestore Query Snapshot listener to Result conversion wrapper.
import FirebaseFirestore
@available(swift 5.0)
public extension Query {
func addSnapshotListener(
includeMetadataChanges: Bool = false,
listener: @escaping (Result<QuerySnapshot, Error>) -> ()
) -> some ListenerRegistration {
addSnapshotListener(includeMetadataChanges: includeMetadataChanges) { snapshot, error in
if let error {
@carlynorama
carlynorama / debouncingTextField.swift
Last active September 17, 2022 16:54
Debouncing Text Field
//
// DebouncingTextField.swift
// LocationSearchResults
//
// Created by Labtanza on 8/13/22.
// https://stackoverflow.com/questions/66164898/swiftui-combine-debounce-textfield
// https://stackoverflow.com/questions/62635914/initialize-stateobject-with-a-parameter-in-swiftui
import SwiftUI
@TheNightmanCodeth
TheNightmanCodeth / XcodeCloudModel.ts
Created September 7, 2022 17:04
Xcode Cloud Webhook Request TypeScript Model
/*
* This file containes interfaces that represent the content of the
* webhook request's body. I won't be using all of these but figured
* someone might find this useful one day <3
*
* Copyright (C) 2022 Joseph Diragi
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or