Skip to content

Instantly share code, notes, and snippets.

Building nice things.

Christian JaNd3r

Building nice things.
Block or report user

Report or block JaNd3r

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
JaNd3r / FirstToUpper.swift
Last active Aug 2, 2016
String extension which adds a function that returns the string with only its first character capitalized.
View FirstToUpper.swift
extension String {
func firstToUpper() -> String {
return self.isEmpty ? "" : String(self.characters.first!).uppercaseString + String(self.characters.dropFirst()).lowercaseString
JaNd3r / MainThreadNotification.swift
Last active Dec 10, 2018
Attention when moving asynchronously UI-changing code to a background thread: Notifications sent using the `NSNotificationCenter.defaultCenter()` must be sent on the main thread. Otherwise you will receive a warning like this: "This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and w…
View MainThreadNotification.swift
func postMainThreadNotificationName(name: String, object: AnyObject?, userInfo: [NSObject : AnyObject]?) {
dispatch_async(dispatch_get_main_queue(), {
NSNotificationCenter.defaultCenter().postNotificationName(name, object: object, userInfo: userInfo)
JaNd3r / HandySnippets.swift
Last active Aug 29, 2015
Loosely collection of Swift snippets...
View HandySnippets.swift
// SwingUtilities.invokeLater ;-)
func invokeLater(delay: CGFloat, code: () -> Void) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(delay * CGFloat(NSEC_PER_SEC))), dispatch_get_main_queue(), code)
// Usage:
invokeLater(0.1) {
You can’t perform that action at this time.