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 findApt (aptNumber: String ) ->String? { | |
let aptNumbers = ["101", "202", "303", "404"] | |
for tempAptNumber in aptNumbers { | |
if (tempAptNumber) == aptNumber { | |
return aptNumber | |
} | |
} | |
return nil |
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 UIKit | |
struct OrderedDictionary<Tk: Hashable, Tv> { | |
var keys: Array<Tk> | |
var values: Dictionary<Tk,Tv> | |
// 1 | |
mutating func insert(value: Tv, forKey key: Tk, atIndex index: Int) -> Tv? |
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
//var double = array[pickerView.selectedRowInComponent(n)] | |
var localCurrency = currencies.currencyList[CurrencyPickerView.selectedRowInComponent(0)] | |
var foreignCurrency = currencies.currencyList[CurrencyPickerView.selectedRowInComponent(1)] |
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 convertCurrency(#localAmount:Double, localCurrency:String, foreignCurrency: String)-> Double { | |
let baseURL = NSURL(string: "http://www.freecurrencyconverterapi.com/api/v2/") | |
let query = String(localCurrency)+"_"+String(foreignCurrency) | |
let forecastURL = NSURL(string: "convert?q="+query, relativeToURL: baseURL) | |
//use a session object to manage.//like the sun | |
let sharedSession = NSURLSession.sharedSession() | |
var convertedAmount:Double = 0.0 |
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 convertCurrency(#localAmount:Double, localCurrency:String, foreignCurrency: String)-> Double { | |
let baseURL = NSURL(string: "http://www.freecurrencyconverterapi.com/api/v2/") | |
let query = String(localCurrency)+"_"+String(foreignCurrency) | |
let forecastURL = NSURL(string: "convert?q="+query, relativeToURL: baseURL) | |
//use a session object to manage.//like the sun | |
let sharedSession = NSURLSession.sharedSession() | |
var convertedAmount:Double = 0.0 |
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
// List all fonts on iPhone | |
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]]; | |
NSArray *fontNames; | |
NSInteger indFamily, indFont; | |
for (indFamily=0; indFamily<[familyNames count]; ++indFamily) | |
{ | |
NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]); | |
fontNames = [[NSArray alloc] initWithArray: | |
[UIFont fontNamesForFamilyName: | |
[familyNames objectAtIndex:indFamily]]]; |
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
SYCRONOUS | |
var currencyList = Dictionary<String, String>() | |
currencyList = ["EUR":"European Euro" , | |
"GPB":"British Pounds", | |
"USD":"US Dollar", | |
"JPY":"Japanese Yen", | |
"RMB":"Chinese Renminbi", | |
"HKD":"Hong Kong Dollar", |
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
extension Dictionary { | |
static func loadJSONFromBundle(filename: String) -> Dictionary<String, AnyObject>? { | |
if let path = NSBundle.mainBundle().pathForResource(filename, ofType: "json") { | |
var error: NSError? | |
let data: NSData? = NSData(contentsOfFile: path, options: NSDataReadingOptions(), error: &error) | |
if let data = data { | |
let dictionary: AnyObject? = NSJSONSerialization.JSONObjectWithData(data, | |
options: NSJSONReadingOptions(), error: &error) |
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
// | |
// GameScene.swift | |
// swiftSpriteKit | |
// | |
// Created by anjani on 07/11/2014. | |
// Copyright (c) 2014 anjani vangallu All rights reserved. | |
import SpriteKit | |
class GameScene: SKScene,SKPhysicsContactDelegate { |
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
// | |
// AppDelegate.m | |
// Sandbox | |
// | |
// Created by Eric Gu on 12/15/14. | |
// Copyright (c) 2014 egu. All rights reserved. | |
// | |
#import "AppDelegate.h" |
OlderNewer