Created
September 21, 2019 14:47
-
-
Save mazz/f705fef9b81801526257dd4ed49b97e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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