Skip to content

Instantly share code, notes, and snippets.

Apokrupto warren-gavin

Block or report user

Report or block warren-gavin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
warren-gavin / UIFont+TextStyle.swift
Created Jun 16, 2018
Get the UIFont.TextStyle that a font was created with
View UIFont+TextStyle.swift
// Fonts can be created with UIFont.preferredFont(forTextStyle:), but there's
// no direct way to find out what textStyle a font was created with.
// Requires: Swift 4.2, iOS 11
extension UIFont {
// Can be nil if the font was created using another method other than UIFont.preferredFont(forTextStyle:)
var textStyle: TextStyle? {
guard let styleName = fontDescriptor.fontAttributes[.textStyle] as? String else {
return nil
View DateStride.swift
enum DateStride {
case year(Int)
case month(Int)
case day(Int)
var component: Calendar.Component {
switch self {
case .year(_):
return .year
View The font of all... well, some

Code snippets for the blog post "The font of all... well, some knowledge"

warren-gavin / Touchy
Last active Feb 12, 2017
Code snippets for blog "Touchy-feely"
View opinion.swift
import Foundation
import FirebaseDatabase
import AcmeJSONLib
struct Opinion {
let text: String
fileprivate let soapBoxing: Bool
// MARK: - Opinions stored in Firebase
warren-gavin /
Last active Nov 5, 2016
Code snippets for the blog post on MVC-RS
View A Math-er of

Code snippets for the blog post "A Math-er of fact"

warren-gavin / Podfile
Created Jul 25, 2016
Swift 3 post installer for Podfiles
View Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
You can’t perform that action at this time.