Skip to content

Instantly share code, notes, and snippets.

View macbaszii's full-sized avatar
🏠
Working from home

iMacbaszii macbaszii

🏠
Working from home
View GitHub Profile
private let CellDefaultHeight: CGFloat = 80.0
private let PlaceholderCellIdentifier = "PlaceholderCell"
private let ProfileCellIdentifier = "ProfileCell"
// MARK: - UITableView Protocol Conformance
extension ViewController: UITableViewDataSource {
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if viewModel.shouldShowPlaceholder {
return Int(CGRectGetHeight(tableView.bounds) / CellDefaultHeight)
} else {
view.backgroundColor = .blackColor()
private extension Selector {
static let buttonTapped =
#selector(ViewController.buttonTapped(_:))
}
...
button.addTarget(self, action: .buttonTapped,
forControlEvents: .TouchUpInside)
private struct Action {
static let buttonTapped =
#selector(ViewController.buttonTapped(_:))
}
...
button.addTarget(self, action: Action.buttonTapped,
forControlEvents: .TouchUpInside)
button.addTarget(self, action: #selector(ViewController.buttonTapped(_:)), forControlEvents: .TouchUpInside)
func segmentedControlValueChanged(sender: UISegmentedControl) { }
func barButtonItemTapped(sender: UIBarButtonItem) { }
func keyboardWillShowNotification(notification: NSNotification) { }
let button = UIButton(type: .System)
button.addTarget(self, action: Selector(“buttonTapped:”), forControlEvents: .TouchUpInside)
// ...
func buttonTapped(sender: UIButton) { }
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler {
return [JLRoutes routeURL:userActivity.webpageURL];
}
[[JLRoutes routesForScheme:@"https"] addRoute:@"/password/reset/:token" handler:^BOOL(NSDictionary *parameters) {
NSString *token = parameters[@"token"];
if (token) {
//do my in-app routing to reset screen
return YES;
}
return NO;
}];