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
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 knowledge.md

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

@warren-gavin
warren-gavin / Touchy Feely.md
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
warren-gavin / mvvm-rrosrws.md
Last active Nov 5, 2016
Code snippets for the blog post on MVC-RS
View mvvm-rrosrws.md
View A Math-er of fact.md

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

@warren-gavin
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['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'YES'
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
You can’t perform that action at this time.