(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
@Test | |
public void testAddNote() { | |
// press “add note” button | |
onView(withId(R.id.addNote)).perform(click()); | |
// type “Espresso rules” as the note content | |
onView(withId(R.id.noteContent)).perform(typeText("Espresso rules")); | |
// press “ok/save” button | |
onView(withId(R.id.ok)).perform(click()); | |
// check if note-list contains note with the text “Espresso rules" | |
onView(withText("Espresso rules")).check(matches(isDisplayed())); |
func test_TeamIsAwesome() { | |
let quickBirdTeamMembers = fetchTeamMembers() | |
let awesomeTeamMembers = quickBirdTeamMembers.filter { teamMember in | |
teamMember.isPassionate && | |
teamMember.isFriendly && | |
teamMember.isConstantlyImproving | |
} | |
XCTAssertEqual(quickBirdTeamMembers.count, awesomeTeamMembers.count) |
fun testTeamIsAwesome() { | |
val quickBirdTeamMembers = fetchTeamMembers() | |
val awesomeTeamMembers = quickBirdTeamMembers.filter { teamMember -> | |
teamMember.isPassionate && | |
teamMember.isFriendly && | |
teamMember.isConstantlyImproving | |
} | |
assertEquals(quickBirdTeamMembers.size, awesomeTeamMembers.size) |
class User: Object { | |
@objc dynamic var id: Int = 0 | |
@objc dynamic var username: String = "" | |
@objc dynamic var updatedDate: Date = Date() | |
override static func primaryKey() -> String? { | |
return "id" | |
} | |
} |
protocol Uploadable: Decodable { | |
var resourceURL: URL { get } | |
} |
class User: Object, Uploadable { | |
@objc dynamic var id: Int = 0 | |
@objc dynamic var username: String = "" | |
@objc dynamic var updatedDate: Date = Date() | |
override static func primaryKey() -> String? { | |
return "id" | |
} | |
var resourceURL: URL { |
extension Uploadable where Self: Object { | |
func getId() -> String { | |
guard let primaryKey = type(of: self).primaryKey() else { | |
fatalError("Object can't be managed without a primary key") | |
} | |
guard let id = self.value(forKey: primaryKey) else { | |
fatalError("Objects primary key isn't set") | |
} |
typealias Syncable = Object & Uploadable | |
struct Update { | |
let insertions: [Syncable] | |
let modifications: [Syncable] | |
let deletedIds: [String] | |
let type: Syncable.Type | |
} | |
extension Uploadable where Self: Object { |
syncService = SyncService(modelTypes: [User.self]) |