Skip to content

Instantly share code, notes, and snippets.


Fernando Bass ferbass

View GitHub Profile
View key

Keybase proof

I hereby claim:

  • I am ferbass on github.
  • I am ferbass ( on keybase.
  • I have a public key ASBIz1bPa8UBMrybqhmZAwxv_qNNUi3ROttgqhpFRc1KkAo

To claim this, I am signing this object:

View key-command.m
NSMutableArray *commands = [[NSMutableArray alloc] init];
NSString *characters = @"`1234567890-=qwertyuiop[]asdfghjkl;'zxcvbnm,./";
for (NSInteger i = 0; i < characters.length; i++) {
NSString *input = [characters substringWithRange:NSMakeRange(i, 1)];
/* Caps Lock */
[commands addObject:[UIKeyCommand keyCommandWithInput:input modifierFlags:UIKeyModifierAlphaShift action:@selector(handleCommand:)]];
/* Shift */
[commands addObject:[UIKeyCommand keyCommandWithInput:input modifierFlags:UIKeyModifierShift action:@selector(handleCommand:)]];
/* Control */
ferbass / button.swift
Created May 3, 2016
Adding a closure as target to a UIButton
View button.swift
import UIKit
extension UIButton {
private func actionHandleBlock(action:(() -> Void)? = nil) {
struct __ {
static var action :(() -> Void)?
if action != nil {
ferbass / rounded button.swift
Last active Apr 26, 2016
Rounded Button in Swift
View rounded button.swift
import UIKit
class RoundedButton: UIButton {
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func drawRect(rect: CGRect) {
let maskPath = UIBezierPath.init(roundedRect: self.bounds, cornerRadius: 5)
View dynamic-type-6.swift
let descriptorFontBody = UIFontDescriptor.preferredFontDescriptorWithTextStyle(UIFontTextStyleBody)
let descriptionFontBodySize = descriptorFontBody.pointSize;
let bodyFont = UIFont(name: "Zapfino", size: descriptionFontBodySize)
label.font = bodyFont;
View dynamic-type-5.m
UIFontDescriptor *descriptorFontBody = [UIFontDescriptor preferredFontDescriptorWithTextStyle:UIFontTextStyleHeadline];
CGFloat descriptorFontBodySize = [userHeadLineFont pointSize];
UIFont *bodyFont = [UIFont fontWithName:@"Zapfino" size:descriptorFontBodySize];
label.font = bodyFont;
View dynamic-type-5.swift
func didReceiveUIContentSizeCategoryDidChangeNotification(notification: NSNotification)
label.font = UIFont.preferredFontForTextStyle(UIFontTextStyleBody)
View dynamic-type-5.swift
selector: "didReceiveUIContentSizeCategoryDidChangeNotification:",
name: UIContentSizeCategoryDidChangeNotification, object: nil)
View dynamic-type-5.m
- (void)didReceiveUIContentSizeCategoryDidChangeNotification:(NSNotification *)notification
label.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
View dynamic-type-3.m
[[NSNotificationCenter defaultCenter] addObserver:self
name:UIContentSizeCategoryDidChangeNotification object:nil];
You can’t perform that action at this time.