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 TrackingListViewModel: ObservableObject { | |
@Published var trackings = [TrackingViewModel]() | |
func getTrackingData() { | |
Webservice().getCovidTrackingResult { trackingList in | |
if let trackingList = trackingList { | |
DispatchQueue.main.async { | |
self.trackings = trackingList.map(TrackingViewModel.init) |
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
// | |
// Tracking.swift | |
// COVID19App | |
// | |
// Created by Mohammad Azam on 4/29/20. | |
// Copyright © 2020 Mohammad Azam. All rights reserved. | |
// | |
import Foundation |
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
// | |
// Webservice.swift | |
// COVID19App | |
// | |
// Created by Mohammad Azam on 4/29/20. | |
// Copyright © 2020 Mohammad Azam. All rights reserved. | |
// | |
import Foundation |
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
// CALLBACKS | |
// Functions that can be called back later | |
// Examples | |
// setInterval | |
function getMovies(moviesDownloaded) { |
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
// HTTP REQUEST | |
// - HEADERS - Tell the server what we are sending and in which format | |
// - BODY - Tell the server about the content | |
let request = new XMLHttpRequest() | |
request.onload = function() { | |
console.log(this.responseText) | |
} |
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
// http://www.omdbapi.com/?s=superman&apikey=564727fa | |
// s and apiKey are called query strings | |
let moviesList = document.getElementById("moviesList") | |
let request = new XMLHttpRequest() | |
// OPTION 1 |
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
// http://www.omdbapi.com/?s=superman&apikey=564727fa | |
// create a new XMLHTTPRequest object which will allow to make a request to the server | |
let request = new XMLHttpRequest() | |
// hook event listener for load event so I can get the data when the request is finished | |
request.addEventListener("load",function() { | |
// "this" is a XMLHttpRequest object | |
// console.log(this.responseText) |
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
Given("I have following tasks") { args, userInfo in | |
XCUIApplication().launch() | |
let rows: NSArray = (userInfo?["DataTable"]) as! NSArray | |
let taskTextField = XCUIApplication().textFields["taskTextField"] | |
for index in 1...rows.count { | |
let taskName = (rows[index] as! NSArray)[0] as! String |
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 wordList = document.getElementById("wordList") | |
function tick() { | |
console.log("TICK") | |
} | |
// 1000 millisecond is 1 second | |
// tick is used here as a callback function | |
// means that it will be called back in 5 seconds |
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
// dishList is a UL element in HTML | |
let dishList = document.getElementById("dishList") | |
// METHOD 1 | |
/* | |
for(let index = 0; index < dishes.length; index++) { | |
let dish = dishes[index] |