Created
January 18, 2016 18:19
-
-
Save aaronksaunders/ce763bea6ca4cab08dac to your computer and use it in GitHub Desktop.
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
| //: Playground - noun: a place where people can play | |
| import UIKit | |
| var str = "Hello, playground" | |
| var myLabel:UILabel = UILabel(frame: CGRectMake(0,0,280,32)) | |
| myLabel.font = UIFont.systemFontOfSize(32.0) | |
| /** | |
| testing so I can use markdown | |
| - returns: Sed do eiusmod tempor. | |
| */ | |
| func what()-> String{ | |
| return "help" | |
| } | |
| /** | |
| testing so I can use markdown | |
| - Parameter val: added to string | |
| - returns: help with a new value | |
| */ | |
| func whatWithParam( val:Int)-> String{ | |
| return "help \(val)" | |
| } | |
| var myMutableString:NSMutableAttributedString; | |
| myMutableString = NSMutableAttributedString(string:"what the what" ); | |
| myMutableString.addAttribute(NSForegroundColorAttributeName, | |
| value: UIColor.redColor(), | |
| range: NSRange( location:5, length:3)) | |
| // multiple attributes at once | |
| var greenAndBold = [String:NSObject]() | |
| greenAndBold[NSForegroundColorAttributeName] = UIColor.greenColor() | |
| greenAndBold[NSFontAttributeName] = UIFont.boldSystemFontOfSize(32.0) | |
| myMutableString.addAttributes(greenAndBold, range: NSRange( location:9, length:4)) | |
| myLabel.attributedText = myMutableString |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment