Suppose you have a few modules in an application which needs to request and parse data from a JSON api:
- Http
- Json parsing
- Business logic, something to do with Images
Each of these can fail in their own way:
| import SwiftUI | |
| enum OSDocumentError: Error { | |
| case unknownFileFormat | |
| } | |
| #if canImport(UIKit) | |
| import UIKit |
| // | |
| // main.swift | |
| // Routes | |
| // | |
| // Created by Chris Eidhof on 17/08/14. | |
| // Copyright (c) 2014 Chris Eidhof. All rights reserved. | |
| // | |
| import Foundation |