Skip to content

Instantly share code, notes, and snippets.


Xavier Matos CalQL8ed-K-OS

View GitHub Profile
CalQL8ed-K-OS / XCTExpectation.swift
Last active Mar 7, 2019 — forked from ole/XCTExpectation.swift
A variant of XCTKVOExpectation that works with native Swift key paths. To try it out, paste the code into an Xcode playground and observe the unit test output in the console. Based on Ole's blog post at, with a fix in the case that the condition on the expectation is already fulfilled.
View XCTExpectation.swift
import XCTest
/// An expectation that is fulfilled when a Key Value Observing (KVO) condition
/// is met. It's variant of `XCTKVOExpectation` with support for native Swift
/// key paths.
final class KVOExpectation: XCTestExpectation {
private var kvoToken: NSKeyValueObservation?
/// Creates an expectation that is fulfilled when a KVO change causes the
/// specified key path of the observed object to have an expected value.
View Playground .gitignore
View static dispatch in protocol extensions.playground
# response to [__Ghost of Swift Bugs Future__ by ALEXANDROS SALAZAR](
protocol A {
func m1() -> String
extension A {
func m1() -> String {
CalQL8ed-K-OS / Template PR Description
Last active Dec 10, 2015
Template PR Description
View Template PR Description
[Story](<link to Story>)
<description of work>
### Dependencies
- [ ] <other PR and tasks>
### Reviews
- [ ] @<users you think should review this PR>
You can’t perform that action at this time.