Skip to content

Instantly share code, notes, and snippets.

View popmedic's full-sized avatar

Popmedic popmedic

View GitHub Profile
import UIKit
public class FontPickerTextField: PickerTextField {
public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
for familyName in UIFont.familyNames() {
self.choices.appendContentsOf(UIFont.fontNamesForFamilyName(familyName))
}
self.choices = self.choices.sort()
self.text = self.choices[0]
@popmedic
popmedic / ColorPickerTextField.swift
Last active July 13, 2018 15:00
ColorPickerTextField - Use ColorPickerTextField when you want to show a list of colors in a UIPickerView when editing text field.
import UIKit
public class ColorPickerTextField: PickerTextField {
public var colorChoices = [
UIColor.blackColor(),
UIColor.blueColor(),
UIColor.brownColor(),
UIColor.darkGrayColor(),
UIColor.cyanColor(),
UIColor.grayColor(),
@popmedic
popmedic / PickerTextField.swift
Last active July 13, 2018 15:01
PickerTextField - Use PickerTextField when you want a list of choices in a UIPickerView displayed in place of the key board.
import UIKit
/**
PickerTextField - Use PickerTextField when you want a list of choices in a UIPickerView displayed in place of the key board.
- Note:
Set it up by setting the choices to an array of strings. These are the strings that will show up in the UIPickerView for the key board.
- Note:
You can set a block for onSelected for action when something is selected.
- Note:
The selectedTimeOut property can be set for the amount of time to wait after something is selected before ending the edit.
@popmedic
popmedic / Logger.swift
Last active July 13, 2018 15:02
LoggerTextView is a subclass of UITextView that can be used as a log for QA of a project. Uses https://gist.github.com/popmedic/291af6918ac4f0a43d187e2379484c64
import UIKit
let __kDefaultColorError = UIColor.redColor()
let __kDefaultColorSuccess = UIColor.greenColor()
let __kDefaultColor = UIColor.whiteColor()
let __kDefaultColorBackground = UIColor.blackColor()
let __kDefaultFont = UIFont(name: "Menlo-Bold", size: 12.0)!
let __kLoggerTextFieldListenerName = "com.webroot.control.LoggerTextField"