Skip to content

Instantly share code, notes, and snippets.

View gabrielribeiro's full-sized avatar

Gabriel Ribeiro gabrielribeiro

View GitHub Profile
@kamilogorek
kamilogorek / _screenshot.md
Last active May 2, 2024 13:48
Clutter-free VS Code Setup
image
@zats
zats / readme.md
Created October 12, 2023 03:08
Private SF Symbols

List of all the images in /Library/Developer/CoreSimulator/Volumes/iOS_21A328/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/SFSymbols.framework/CoreGlyphsPrivate.bundle/Assets.car

NSBundle *const sfSymbolsBundle = [SFSCoreGlyphsBundle private];
_UIAssetManager *const assetManager = [_UIAssetManager assetManagerForBundle:sfSymbolsBundle];
UIImage *const image = [assetManager imageNamed:@"apple.breathe"];
enum QueryPredicate {
case isEqualTo(_ field: String, _ value: Any)
case isNotEqualTo(_ field: String, _ value: Any)
case isIn(_ field: String, _ values: [Any])
case isNotIn(_ field: String, _ values: [Any])
case arrayContains(_ field: String, _ value: Any)
case arrayContainsAny(_ field: String, _ values: [Any])
import SwiftUI
import Combine
public struct ChangeObserver<V: Equatable>: ViewModifier {
public init(newValue: V, action: @escaping (V) -> Void) {
self.newValue = newValue
self.newAction = action
}
private typealias Action = (V) -> Void
@christianselig
christianselig / zombie-banana.swift
Created March 20, 2021 20:12
Zombie banana uprising
class Banana: NSObject, NSSecureCoding {
let bananaName: String
let userInfo: [String: Any]
static var supportsSecureCoding: Bool = true
init(bananaName: String, userInfo: [String: Any]) {
self.bananaName = bananaName
self.userInfo = userInfo
}
extension Result {
public func `catch`(_ handler: () throws -> Success) -> Result<Success, Error> {
flatMapError { _ in
.init { try handler() }
}
}
public func `catch`(_ handler: (Failure) throws -> Success) -> Result<Success, Error> {
flatMapError { error in
.init { try handler(error) }
import Foundation
import MapKit
final class MapKitService {
// Map the Apple Category to your own category
private let typesToDrink: [MKPointOfInterestCategory] = [.brewery, .cafe, .winery]
private let typesToEat: [MKPointOfInterestCategory] = [.foodMarket, .restaurant]
func retrieve(from: String, completionBlock: @escaping ([Place]) -> Void) {
@tera-ny
tera-ny / Document.swift
Last active March 27, 2023 22:15
Swift + Combine + Firestore
import Foundation
import FirebaseFirestoreSwift
import FirebaseFirestore
import Combine
struct Document<Model: Codable> {
let ref: DocumentReference
let data: Model
static func get(collectionPath: String, id: String) -> Deferred<Future<Document<Model>, Error>> {
.init { () -> Future<Document<Model>, Error> in
@DreamingInBinary
DreamingInBinary / Best in Class iOS Checklist
Last active January 29, 2024 18:18
This is a public checklist updated every year after the latest version of iOS and iPadOS are shipped. It's a boiled down version of a "Best in Class" app checklist created by Jordan Morgan.
# A Best in Class Checklist
A boiled down checklist adapted from this [post](https://www.swiftjectivec.com/a-best-in-class-app/), created by @jordanmorgan10.
> To use this, create a Github Issue in your own repo, and simply copy and paste this text.
## iOS Core Technology
_Things any iOS app can benefit from_
- [ ] iCloud Sync
- [ ] Focus Filter Support
// Created by gil_birman on 11/22/19.
import Combine
import FirebaseFirestore
import FirebaseStorage
import Foundation
enum FirebaseCombineError: Error {
case encodeImageFailed
case nilResultError