Skip to content

Instantly share code, notes, and snippets.

View ykpoh's full-sized avatar

Yk Poh ykpoh

  • Melaka, Malaysia
View GitHub Profile
import Foundation
@testable import SpaceXLaunch
import XCTest
extension XCTest {
func givenLaunches(count: Int) -> [Launch] {
return (1 ... count).map { i in
return Launch(id: "id_\(i)", name: "name_\(i)", details: "details_\(i)", date_utc: Date(), upcoming: true, success: true, rocket: "rocket_\(i)")
}
}
import XCTest
@testable import SpaceXLaunch
import RxCocoa
class LaunchListViewControllerTests: XCTestCase {
var sut: LaunchListViewController!
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
try super.setUpWithError()
import KeychainAccess
class KeychainHelper {
let service = "QKLSKFNAE1.com.example.yungkien.com.shared"
let accessGroup = "group.com.example.yungkien.com.shared"
func save(_ key: String, _ value: String) throws {
let keychain = Keychain(service: service, accessGroup: accessGroup)
try keychain.set(value, key: key.rawValue)
}
struct Provider: TimelineProvider {
func placeholder(in context: Context) -> SimpleEntry {
SimpleEntry(date: Date(), building: .barrack)
}
func getSnapshot(in context: Context, completion: @escaping (SimpleEntry) -> ()) {
let entry = SimpleEntry(date: Date(), building: .barrack)
completion(entry)
}