Skip to content

Instantly share code, notes, and snippets.

View JohnEstropia's full-sized avatar
🏠
Working from home

John Estropia JohnEstropia

🏠
Working from home
View GitHub Profile
@JohnEstropia
JohnEstropia / JEAssociatedObjects.h
Last active December 31, 2015 08:19
Synthesizing properties in Objective-C categories (simple version)
//
// JEAssociatedObjects.h
// JEToolkit
//
// Created by John Rommel Estropia on 2013/10/26.
// Copyright (c) 2013 John Rommel Estropia. All rights reserved.
//
#import <objc/runtime.h>
@JohnEstropia
JohnEstropia / JEProgressView.h
Last active October 5, 2023 14:59
Workaround an annoying bug with iOS 7.1 where custom track and progress images for UIProgressView gets ignored
//
// JEProgressView.h
//
//
// Created by John Rommel Estropia on 2014/03/11.
// Copyright (c) 2014 John Rommel Estropia.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@JohnEstropia
JohnEstropia / frchack.swift
Last active June 8, 2018 08:00
A workaround for an NSFetchedResultsController bug introduced in XCode 7. Credits to stackoverflow user Andy: http://stackoverflow.com/a/32466951/809614
// Workaround a nasty bug introduced in XCode 7 targeted at iOS 8 devices
// https://forums.developer.apple.com/message/9998#9998
// https://forums.developer.apple.com/message/31849#31849
// This is not my original idea. Please give your stars to stackoverflow user Andy for sharing his solution: http://stackoverflow.com/a/32466951/809614
class MyFetchedResultsControllerDelegate: NSObject, NSFetchedResultsControllerDelegate {
// ... your code
// MARK: Private
@JohnEstropia
JohnEstropia / StaticDynamicModels.swift
Last active March 4, 2017 09:05
try!Swift 2017 Hackathon entry (XCode 8.3 beta playground file): https://devpost.com/software/resource-free-core-data-models
import CoreData
//: # Implementation
protocol ValueProtocol {
static func empty() -> Self
static func attributeType() -> NSAttributeType
func encode() -> Any
@JohnEstropia
JohnEstropia / LazyCachedCollection.swift
Last active September 27, 2017 05:06
Collection that lazily initializes and caches its elements. Initially requires only the indexes and initializes elements as needed (e.g. UITableView data)
//
// LazyCachedCollection.swift
//
// Created by John Estropia on 2017/09/27.
// Copyright © 2017 John Estropia. All rights reserved.
//
import Foundation
class LazyCachedCollection<Element>: RandomAccessCollection {
//
// RadialView.swift
//
//
// Created by John Rommel Estropia on 2016/08/06.
// Copyright © 2016 JohnEstropia. All rights reserved.
//
import UIKit
04b8a96df1ba92ff009ea7cf2a174f1858c8b2b98459646cd7144bdb658cbd0d053c453465e29695e1d48462bf3f6c07ad75dc9e6089c3f43e4cced295db02c58f;bogdano