Skip to content

Instantly share code, notes, and snippets.

View startover205's full-sized avatar

Sam Yang startover205

  • Taoyuan, Taiwan
View GitHub Profile
@ohtwo
ohtwo / gmsmarker.swift
Last active October 27, 2020 01:19
GMSMarker with Drop Shadow
import Foundation
import GoogleMaps
func getShadowMarker() -> GMSMarker {
let marker = GMSMarker()
let image = UIImageView(image: UIImage(named: "marker"))
marker.iconView = image
marker.iconView?.contentMode = .center
marker.iconView?.bounds.size.width *= 2
@MattSHallatt
MattSHallatt / DateComponentsFormatter.playground
Created November 30, 2017 15:06
DateComponentsFormatter Playground
import UIKit
/*:
DateComponentsFormatter: A formatter that creates string representations of quantities of time.
*/
let dateComponentsFormatter = DateComponentsFormatter()
/*:
A DateComponentsFormatter can be configured with an array of NSCalendarUnits. These components are then used in the output.
@avaleriani
avaleriani / currencies.json
Last active April 14, 2024 09:00
Currencies list with emoji flags. Same as https://gist.github.com/avaleriani/2ce5d24f905825ce0e2f8489c9fda4c3 but in json.
{
"currencies": [
{
"symbol": "€",
"name": "Euro",
"symbol_native": "€",
"code": "EUR",
"emoji": "🇪🇺"
},
{
@bermudalocket
bermudalocket / Color+systemColors.swift
Created April 5, 2020 17:56
A Color convenience extension to make adaptable UIColors more accessible in SwiftUI.
extension Color {
static let systemRed = Color(UIColor.systemRed)
static let systemGreen = Color(UIColor.systemGreen)
static let systemTeal = Color(UIColor.systemTeal)
static let systemBlue = Color(UIColor.systemBlue)
static let systemYellow = Color(UIColor.systemYellow)
static let systemOrange = Color(UIColor.systemOrange)
static let systemPink = Color(UIColor.systemPink)
static let systemPurple = Color(UIColor.systemPurple)
static let systemIndigo = Color(UIColor.systemIndigo)
@vibrazy
vibrazy / OptionSetSwiftUI.swift
Last active June 12, 2024 02:40
Using OptionSet to simplify your view state. Unify your states into 1
//
// Created by Daniel Tavares on 07/05/2021.
//
import SwiftUI
// MARK: - OptionsSet
// Blog post https://dev.to/vibrazy/easy-swiftui-view-bindings-using-optionset-and-sourcery-4edb
protocol OptionsBinding {}
@peterfriese
peterfriese / Color+Codable.swift
Created March 19, 2021 11:00
Making Swift's Color codable
//
// Color+Codable.swift
// FirestoreCodableSamples
//
// Created by Peter Friese on 18.03.21.
//
import SwiftUI
// Inspired by https://cocoacasts.com/from-hex-to-uicolor-and-back-in-swift