Skip to content

Instantly share code, notes, and snippets.

View clayellis's full-sized avatar

Clay Ellis clayellis

View GitHub Profile
// This gist demonstrates how ObservableObjects can be composed in a simple way by leveraging a new
// @Republished property wrapper. @Republished republishes child state objectWillChange messages on its
// parent's objectWillChange publisher, tying the two together.
// The example app is from PointFree Co's episode: https://www.pointfree.co/episodes/ep146-derived-behavior-the-problem
// The one major change besides @Republished is that the "favorites" state has been extracted from the
// Counter/ProfileViewModels into a single source of truth: FavoritesViewModel.
import Combine
@clayellis
clayellis / Best in Class iOS Checklist
Created July 7, 2020 16:30 — forked from DreamingInBinary/Best in Class iOS Checklist
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
- [ ] [Core Spotlight integration](https://github.com/DreamingInBinary/Spend-Stack/issues/120)
import UIKit
import PDFKit
class PDFViewController: UIViewController {
let pdfDocument: PDFDocument
fileprivate let pdfView = PDFView()
enum PDFError: Error {
case failedToLoadPDFDocument
@clayellis
clayellis / Ownable.swift
Created July 23, 2018 17:27
Verify ownership of objects in Vapor
import Vapor
import Fluent
/// An object that can be owned.
protocol Ownable {
/// The Owner type that owns this object.
associatedtype OwnerType
/// Type of the Owner's ID
associatedtype OwnerIDType
@clayellis
clayellis / CloudKit+DebugDescriptions.swift
Created May 29, 2018 19:27
Debug descriptions for CloudKit enums
import CloudKit
extension CKAccountStatus: CustomDebugStringConvertible {
public var debugDescription: String {
switch self {
case .available:
return "Available"
case .noAccount:
return "No Account"
case .restricted:
@clayellis
clayellis / MultipleConfigurations.md
Last active January 22, 2018 17:09
A scrappy step-by-step to creating multiple configurations for an iOS target
  1. Create a Production.xcconfig and a Development.xcconfig file (or whatever you want to call them)
  2. In both of those config files: (production) [development]
BUNDLE_IDENTIFIER = (com.company.ios) [com.company.ios.dev]
PRODUCT_NAME = (App) [App Dev]
API_SCHEME = (https) [https]
API_HOST = (api.company.com) [dev.company.com]
  1. In the Project Navigator select the Project (not a Target) > Info > Configurations > + “Duplicate Debug” > Rename to “Development Debug”
  2. Rename “Debug” -> “Production Debug”, “Release” -> “Production Release”
//
// UIColor+Extras.swift
// Clay Ellis
// https://gist.github.com/clayellis/ca658582e111c2525cd38f3ede735362
//
import UIKit
extension UIColor {
//
// UIImage+Extras.swift
// Clay Ellis
// https://gist.github.com/clayellis/3c3bfdee9cac8e9b12ecaefb103d916b
//
import UIKit
extension UIImage {
//
// UIButton+Extras.swift
// Clay Ellis
// https://gist.github.com/clayellis/5394d087e63161c2b42ad1c9ded6dc25
//
import UIKit
extension UIButton {
@clayellis
clayellis / UIView+Extras.swift
Last active May 23, 2021 14:12
UIView Extensions
//
// UIView+Extras.swift
// Clay Ellis
// gist.github.com/clayellis/0cf1b1092b6a08cb4c5b2da9abee5ed9
//
import UIKit
@objc public protocol ConfigurableView {
@objc optional func configure()