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
/* | |
Below is a code that creates an array of Cat objects and an array | |
of their meowPatterns. | |
Can you match pattern with the cat, store the pattern variable inside the | |
Cat and modify the “meow” function to print either “MEOW” or “meow”? | |
1. Match the meowPatterns with cats and store its pattern inside the Cat | |
object |
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
// | |
// MainViewController.swift | |
// Badges | |
// | |
// Created by Charles Kang on 6/14/16. | |
// Copyright © 2016 Charles Kang. All rights reserved. | |
// | |
import UIKit | |
import SwiftyJSON |
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
// | |
// BadgeAPI.swift | |
// Badges | |
// | |
// Created by Charles Kang on 6/15/16. | |
// Copyright © 2016 Charles Kang. All rights reserved. | |
// | |
import Foundation | |
import SwiftyJSON |
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 Foundation | |
import SwiftyJSON | |
class BadgeAPI { | |
public func main(function: Void -> Void) { | |
dispatch_async(dispatch_get_main_queue(), function) | |
let jsonURL = "http://www.khanacademy.org/api/v1/badges" | |
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
class func parseBadgeJSON () | |
{ | |
let jsonURL = "http://www.khanacademy.org/api/v1/badges" | |
if let url = NSURL(string: jsonURL) { | |
if let data = try? NSData(contentsOfURL: url, options: []) { | |
let json = JSON(data: data) | |
fetchBadgeJSON(json) | |
} |
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
// | |
// MainViewController.swift | |
// Badges | |
// | |
// Created by Charles Kang on 6/14/16. | |
// Copyright © 2016 Charles Kang. All rights reserved. | |
// | |
import UIKit | |
import SwiftyJSON |
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
// | |
// CMLoginViewController.swift | |
// Coffee Mapper | |
// | |
// Created by Charles Kang on 4/13/16. | |
// Copyright © 2016 Charles Kang. All rights reserved. | |
// | |
import UIKit |
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
// | |
// LoginViewController.swift | |
// FirebaseJokes | |
// | |
// Created by Matthew Maher on 1/23/16. | |
// Copyright © 2016 Matt Maher. All rights reserved. | |
// | |
import UIKit |
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
@IBAction func signUpButtonTapped(sender: AnyObject) | |
{ | |
let username = usernameTextField.text | |
let email = emailTextField.text | |
let password = passwordTextField.text | |
if username != "" && email != "" && password != "" { | |
DataService.dataService.BASE_REF.createUser(email, password: password, withValueCompletionBlock: { error, result in | |
if error != nil {3 | |
self.signupErrorAlert("Oops!", message: "Having some trouble creating your account. Please try again.") |
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
@IBAction func createAccount(sender: AnyObject) { | |
let username = usernameField.text | |
let email = emailField.text | |
let password = passwordField.text | |
if username != "" && email != "" && password != "" { | |
// Set Email and Password for the New User. | |
DataService.dataService.BASE_REF.createUser(email, password: password, withValueCompletionBlock: { error, result in |