Use Nimble to express the expected outcomes of Swift or Objective-C expressions. Inspired by Cedar.
// Swift expect(1 + 1).to(equal(2)) expect(1.2).to(beCloseTo(1.1, within: 0.1)) expect(3) > 2 expect("seahorse").to(contain("sea")) expect(["Atlantic", "Pacific"]).toNot(contain("Mississippi")) expect(ocean.isClean).toEventually(beTruthy())
Some Background: Expressing Outcomes Using Assertions in XCTest
Apple’s Xcode includes the XCTest framework, which provides assertion macros to test whether code behaves properly. For example, to assert that
1 + 1 = 2, XCTest has you write:
// Swift XCTAssertEqual(1 + 1, 2, "expected one plus one to equal two")
Or, in Objective-C:
// Objective-C XCTAssertEqual(1 + 1, 2, @"expected one plus one to equal two");
XCTest assertions have a couple of drawbacks:
- Not enough macros. There’s no easy way to assert that a string contains a particular substring, or that a number is less than or equal to another.
- It’s hard to write asynchronous tests. XCTest forces you to write a lot of boilerplate code.
Nimble addresses these concerns.
What is Copy-On-Write
Copy-On-Write (COW) is a strategy used in computer programming and operating systems to optimize the performance and efficiency of memory...
Mobile App Development Best Practices – 11.12
Large photos in SwiftUI, Mutation Testing, Processing Payments in Firebase and more!
SDKs for which Apple will require a signature have been published
Apple has already listed SDKs commonly used in apps in the App Store that, from spring 2024, you will be...
Discover the Journaling Suggestions API
Journaling Suggestions is a visual picker interface for iPhone applications. It displays personal events that are happening in a person’s...
Tusky – An Android client for the microblogging server Mastodon
Tusky is a beautiful Android client for Mastodon. Mastodon is an ActivityPub federated social network. That means no single entity controls...
Swift 30 Projects: 30 mini Swift Apps for self-study
This repo is updated with Swift 5 and compatible with iPhone X: Simple UIKit components UIScrollView, UITableView, UICollectionView CAAnimations and...