A curated list of arguments that can be used for enabling tools on iOS development.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
do{ | |
func compressImage(_ img:UIImage) -> UIImage? { | |
// Reducing file size to a 10th | |
var actualHeight: CGFloat = img.size.height | |
var actualWidth: CGFloat = img.size.width | |
let maxHeight: CGFloat = 1136.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nm __BINARY__ | awk '{ print $3 }' | xargs xcrun swift-demangle {} \; | less |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Shamelessly ripped of from https://blog.curtisherbert.com/automated-xcode-build-numbers-early-2019-edition/ | |
# | |
git=`sh /etc/profile; which git` | |
bundleVersion=`"$git" rev-list --all | wc -l | tr -d '[:space:]'` | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $bundleVersion" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" | |
echo "☛ BUILD NUMBER: ${bundleVersion}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UnsafeMutablePointer { | |
/// Converts `C` decayed array to `Swift` array | |
/// | |
/// - Parameter count: Number of elements in the `C` array | |
/// - Returns: Converted `Swift` array | |
public func toArray(count: Int) -> [Pointee] { | |
defer { self.deallocate() } | |
return Array(UnsafeBufferPointer(start: self, count: count)) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as firebase from 'firebase/app'; | |
import 'firebase/firestore'; | |
var firebaseConfig = { | |
// your firebase credentials | |
}; | |
// Initialize Firebase | |
firebase.initializeApp(firebaseConfig); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Example Model class that can be used for deocding/encoding for persisting in Firestore | |
// Book.swift | |
// Created by Neil Poulin on 4/7/19. | |
// | |
import Foundation | |
import FirebaseFirestore | |
struct Book: FirestoreIdentifiable, Hashable { | |
static let collectionName = FirestoreCollectionName.books |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Combine | |
enum APIError: Error, LocalizedError { | |
case unknown, apiError(reason: String) | |
var errorDescription: String? { | |
switch self { | |
case .unknown: | |
return "Unknown error" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Created by Marcin Krzyzanowski | |
import Foundation | |
public protocol JSONEncodable: Encodable { } | |
public extension JSONEncodable { | |
func toJSON(using encoder: @autoclosure () -> JSONEncoder = JSONEncoder()) throws -> String { | |
try String(decoding: encoder().encode(self), as: UTF8.self) | |
} |