This file contains 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
struct Array2D<T> { | |
let columns: Int | |
let rows: Int | |
private var array: Array<T?> | |
init(columns: Int, rows: Int) { | |
self.columns = columns | |
self.rows = rows |
This file contains 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 SpriteKit | |
protocol GameSceneDelegate { | |
func gameOver() | |
} | |
class GameScene: SKScene { | |
var gameSceneDelegate: GameSceneDelegate? | |
var health: Int = 10 |
This file contains 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 SpriteKit | |
class GameViewController: UIViewController, GameSceneDelegate { | |
@IBOutlet weak var skView: SKView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let scene = GameScene(size: skView.bounds.size) |
This file contains 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 Darwin | |
/** | |
Representation of a connected socket or error. | |
Either a Descriptor with an associated value for the POSIX | |
socket file descriptor or an Error with a string describing | |
the error. | |
*/ | |
enum Connection { | |
case Descriptor(CInt) |
This file contains 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
// See the accompanying blog post: http://chris.eidhof.nl/posts/tiny-networking-in-swift.html | |
public enum Method: String { // Bluntly stolen from Alamofire | |
case OPTIONS = "OPTIONS" | |
case GET = "GET" | |
case HEAD = "HEAD" | |
case POST = "POST" | |
case PUT = "PUT" | |
case PATCH = "PATCH" | |
case DELETE = "DELETE" |
This file contains 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
func setupCellForCheckins() { | |
let venueName: String = utils.getParamFromDictionary(cellData, searchKey: "check_in_title", defaultStr: "No data") | |
titleLabel?.text = venueName | |
let usersCheckedIn: String = utils.getParamFromDictionary(cellData, searchKey: "check_in_location_appended_data_collection", defaultStr: "No data") | |
messageSenderLabel?.text = usersCheckedIn | |
let timeAgo: String = utils.getParamFromDictionary(cellData, searchKey: "user_creation_date_ago", defaultStr: "No data") | |
messageTimeLabel?.text = timeAgo |
This file contains 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
func setupCellForPublic() { | |
let name: String = utils.getParamFromDictionary(cellData, searchKey: "message_author_name", defaultStr: "?") | |
titleLabel?.text = name | |
let currentVenue = utils.getParamFromDictionary(cellData, searchKey: "message_current_venue", defaultStr: "?") | |
messageSenderLabel?.text = currentVenue | |
let timeAgo = utils.getParamFromDictionary(cellData, searchKey: "message_last_message_time", defaultStr: "?") |
This file contains 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
private extension NewMessageViewController { | |
func checkLocationPermisions() { | |
let status = CLLocationManager.authorizationStatus() | |
switch status { | |
case .NotDetermined: | |
dataMgr.locationManager.requestWhenInUseAuthorization() | |
break | |
case .AuthorizedWhenInUse: |
This file contains 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
PFObject *tempBill = [PFObject objectWithClassName:@"Bill"]; | |
tempBill[@"amount"] = @0; | |
tempBill[@"category"] = @""; | |
tempBill[@"comment"] = pfBill[@"comment"]; | |
tempBill[@"date"] = pfBill[@"date"]; | |
tempBill[@"parentCategory"] = pfBill[@"parentCategory"]; | |
tempBill[@"type"] = pfBill[@"type"]; | |
[weakSelf saveBill:tempBill pfObjectWithRelations:pfObjectWithRelations completionBlock:^{ | |
__weak __typeof(self) weakSelf = self; | |
[weakSelf saveBill:pfBill pfObjectWithRelations:tempBill completionBlock:nil]; |
OlderNewer