Code snippets for the blog post "The font of all... well, some knowledge"
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
// 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 | |
} |
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
enum DateStride { | |
case year(Int) | |
case month(Int) | |
case day(Int) | |
var component: Calendar.Component { | |
switch self { | |
case .year(_): | |
return .year | |
Code snippets for the blog post "Touchy Feely" http://www.apokrupto.com/blog-1/2017/2/11/touchy-feely
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 FirebaseDatabase | |
import AcmeJSONLib | |
struct Opinion { | |
let text: String | |
fileprivate let soapBoxing: Bool | |
} | |
// MARK: - Opinions stored in Firebase |
Code snippets for the blog post "Let me tell you a storey" at http://www.apokrupto.com/blog-1/2016/10/22/mvc-rrosrws
Code snippets for the blog post "A Math-er of fact"
Code snippets for the blog post "Swift Protocols and the Law of Unintended Consequences" at http://www.apokrupto.com/blog-1/2016/8/14/swift-protocols-and-the-law-of-unintended-consequences
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
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 |
Code snippets for the blog post "Animation killed the CPU star" at http://www.apokrupto.com/blog-1/2016/7/16/qd2osqnhgywx23tqm6qcpwgouufpls
NewerOlder