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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <array> | |
| <dict> | |
| <key>name</key> | |
| <string>peanuts</string> | |
| <key>displayName</key> | |
| <string>Peanuts</string> | |
| <key>imageName</key> |
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
| extension Date { | |
| func ageGeneration() -> SPKAgeGeneration { | |
| let year = Calendar.current.component(.year, from: self) | |
| if year < 1927 { | |
| return .greatest | |
| } else if year < 1946 { | |
| return .silent | |
| } else if year < 1965 { | |
| return .boomer |
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
| extension Date { | |
| func ageGeneration() -> SPKAgeGeneration { | |
| let year = Calendar.current.component(.year, from: self) | |
| if year < 1927 { | |
| return .greatest | |
| } else if year < 1946 { | |
| return .silent | |
| } else if year < 1965 { | |
| return .boomer |
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
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| _ = Timer.scheduledTimer(timeInterval: 1.5, target: self, selector: #selector(AddLocationViewController.updateSearchText), userInfo: nil, repeats: true) | |
| } | |
| func updateSearchText() { | |
| if previousSearchText != searchTextField.text { | |
| previousSearchText = searchTextField.text! | |
| tableDataSource.sourceTextHasChanged(searchTextField.text) |
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
| let planets : Set<String> = ["K186", "K186B", "Earth", "Mars"] | |
| let oldPlanets : Set<String> = ["Earth", "Mars", "Jupiter"] | |
| let addedPlanets = planets.subtracting(oldPlanets) | |
| let removedPlanets = oldPlanets.subtracting(planets) |
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
| import SafariServices | |
| extension MainViewController: FlippedViewDelegate, SFSafariViewControllerDelegate { | |
| func didTapTicketsButton(button: UIButton) { | |
| if #available(iOS 9.0, *) { | |
| let svc = SFSafariViewController(URL: NSURL(string: kURLTickets)!) | |
| svc.delegate = self | |
| popup!.dismiss(true) | |
| self.presentViewController(svc, animated: true, completion: nil) |
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
| class func retrieveAllUsers(withNameLike name : String, completed : ((users : [BackendlessUser]?, fault : Fault?) -> Void)?) { | |
| let backendless = Backendless.sharedInstance() | |
| let query = BackendlessDataQuery() | |
| // Use backendless.persistenceService to obtain a ref to a data store for the class | |
| let whereClause = "name LIKE '\(name)'" | |
| query.whereClause = whereClause | |
| let dataStore = backendless.persistenceService.of(BackendlessUser.ofClass()) as IDataStore |
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
| extension NSDate { | |
| func timeAgoSinceDate(numericDates:Bool) -> String { | |
| let calendar = NSCalendar.currentCalendar() | |
| let now = NSDate() | |
| let earliest = now.earlierDate(self) | |
| let latest = (earliest == now) ? self : now | |
| let components:NSDateComponents = calendar.components([NSCalendarUnit.Minute , NSCalendarUnit.Hour , NSCalendarUnit.Day , NSCalendarUnit.WeekOfYear , NSCalendarUnit.Month , NSCalendarUnit.Year , NSCalendarUnit.Second], fromDate: earliest, toDate: latest, options: NSCalendarOptions()) | |
| if (components.year >= 2) { | |
| return "\(components.year) years ago" |
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
| @Asset( "Friendship" ) | |
| public class FriendshipTableEventHandler extends com.backendless.servercode.extension.PersistenceExtender<Friendship> | |
| { | |
| @Override | |
| public void afterCreate( RunnerContext context, Friendship friendship, ExecutionResult<Friendship> result ) throws Exception | |
| { | |
| if (!friendship.getGroup()) { | |
| BackendlessUser user = friendship.getMembers().get(0); | |
| BackendlessUser friend = friendship.getMembers().get(1); | |
| updateFriendsForUser(user, friend); |
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
| // | |
| // Friendship.swift | |
| // SuhDude | |
| // | |
| // Created by Vik Denic on 3/11/16. | |
| // Copyright © 2016 nektur labs. All rights reserved. | |
| // | |
| import UIKit |