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
//
// ContentView.swift
//
// Created by Chris Eidhof on 20.04.20.
// Copyright © 2020 objc.io. All rights reserved.
//
import SwiftUI
import UIKit
import XCTest
import Firebase
extension XCTestCase {
func clearFirestore() {
let semaphore = DispatchSemaphore(value: 0)
let projectId = FirebaseApp.app()!.options.projectID!
let url = URL(string: "http://localhost:8080/emulator/v1/projects/\(projectId)/databases/(default)/documents")!
var request = URLRequest(url: url)
@mariusc
mariusc / conferences.md
Last active June 17, 2020 07:58
2020 iOS/mobile conferences status (as of May 8th)
Name Date Location Status
iOS Conf SG January 15-18 🇸🇬 Singapore Happened
dotSwift February 3 🇫🇷 Paris Happened
MobOS February 20-21 🇷🇴 Cluj Napoca Happened
Appdevcon March 10-13 🇳🇱 Amsterdam Postponed
try! Swift Tokyo March 18-20 🇯🇵 Tokyo Cancelled
CodeMobile April 28-29 🇬🇧 London Cancelled
App Builders May 11-12 🇨🇭 Lugano Online
UIKonf May 18-19 🇩🇪 Berlin Online
@chriseidhof
chriseidhof / boilerplate.swift
Last active April 17, 2025 11:08
QuickMacApp
// Run any SwiftUI view as a Mac app.
import Cocoa
import SwiftUI
NSApplication.shared.run {
VStack {
Text("Hello, World")
.padding()
.background(Capsule().fill(Color.blue))
//
// AnimatableVector2D.swift
//
// this is derivation of generic AnimatableVector presented at: https://nerdyak.tech/development/2020/01/12/animating-complex-shapes-in-swiftui.html
//
// Created by Pavel Zak on 18/05/2020.
//
import SwiftUI
import Foundation
struct Post: Decodable {
let id: String
let title: String
let body: String
}
struct GraphQLResult<T: Decodable>: Decodable {
let object: T?
@felix-larsen
felix-larsen / CustomPhotoPickerView.swift
Last active May 16, 2024 06:58
PHPhotoPicker metadata example
import SwiftUI
import PhotosUI
struct CustomPhotoPickerView: UIViewControllerRepresentable {
@Binding var selectedImage: UIImage?
@Binding var date: Date?
@Binding var location: CLLocationCoordinate2D?
@Environment(\.presentationMode) var presentationMode
#!/bin/sh
# make sure you have imagemagick installed: brew install imagemagick
# your app_icons.sh file should have the correct permissions: run `chmod 775 app_icons.sh` in your terminal from where you put this file
# put your `my_icon.png` next to this file and run ./app_icons.sh to export your app icons
x=my_icon.png
y=${x%.*}
# delete the export directory so we start clean
@grosch
grosch / IntegerTextField.swift
Created December 21, 2020 11:23
SwiftUI TextField which only accepts integers and binds to an Int? instead of a String
import SwiftUI
private class IntegerTextFieldValue: ObservableObject {
@Published var value = "" {
didSet {
let numbersOnly = value.filter { $0.isNumber }
if value != numbersOnly {
value = numbersOnly
}
}
https://api.opentripmap.com/0.1/en/places/geoname?name=Lima&apikey=5ae2e3f221c38a28845f05b66b2ebd0c0a4a7428f0803525b45f11d8
{
"name": "lima",
"country": "PE",
"lat": -12.04318,
"lon": -77.02824,
"population": 7737002,
"timezone": "America/Lima",
"status": "OK"