Skip to content

Instantly share code, notes, and snippets.

@AliSoftware
AliSoftware / Demo.swift
Last active October 31, 2023 12:25
NestableCodingKey: Nice way to define nested coding keys for properties
struct Contact: Decodable, CustomStringConvertible {
var id: String
@NestedKey
var firstname: String
@NestedKey
var lastname: String
@NestedKey
var address: String
enum CodingKeys: String, NestableCodingKey {
@DejanEnspyra
DejanEnspyra / Obfuscator.swift
Created May 31, 2017 17:51
Obfuscation of hard-coded security-sensitive strings.
//
// Obfuscator.swift
//
// Created by Dejan Atanasov on 2017-05-31.
//
import Foundation
class Obfuscator: AnyObject {
@cohenadair
cohenadair / firebase-sandbox.md
Last active September 26, 2023 05:39
Setting up development and production Firebase environments for iOS

Firebase Environments

Last updated: October 21st, 2019.

At the time of writing this gist (January 4th, 2017), I was unable to find true sandboxing to separate development and production environments for a Firebase project. The closest we can get is to create two separate Firebase projects -- one for development and one for production.

Pros

  • Complete separation and isolation of all Firebase features.
  • Freedom to experiment without risking the corruption of production data.

Cons

@devonc
devonc / UIImage+ImageEffects.swift
Last active November 7, 2019 20:07
Image Effect Category in Swift
import Accelerate
import UIKit
public extension UIImage {
public func applyLightEffect() -> UIImage? {
return applyBlur(radius: 30, tintColor: UIColor(white: 1, alpha: 0.3))
}
public func applyExtraLightEffect() -> UIImage? {
return applyBlur(radius: 20, tintColor: UIColor(white: 0.97, alpha: 0.82))
@acj
acj / TrimVideo.swift
Last active November 2, 2023 15:05
Trim video using AVFoundation in Swift
//
// TrimVideo.swift
// VideoLab
//
// Created by Adam Jensen on 3/28/15.
// Updated for Swift 5 (tested with Xcode 10.3) on 7/30/19.
// MIT license
//
import AVFoundation