Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mazz
Created September 21, 2019 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mazz/f705fef9b81801526257dd4ed49b97e0 to your computer and use it in GitHub Desktop.
Save mazz/f705fef9b81801526257dd4ed49b97e0 to your computer and use it in GitHub Desktop.
public func fetchCourses() -> Single<[MbyCourse]> {
return Single.create { [unowned self] single in
do {
var fetchCourses: [MbyCourse] = []
// let chapters: [Org]!
try self.dbPool.read { db in
fetchCourses = try MbyCourse.fetchAll(db)
}
single(.success(fetchCourses))
} catch {
print("error: \(error)")
single(.error(error))
}
return Disposables.create {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment