// Copyright © 2020 Australian Government All rights reserved. import Foundation class GetJMCTargeAction: AsyncAction { let onComplete: (Outcome) -> Void init(onComplete: @escaping (Outcome) -> Void) { self.onComplete = onComplete super.init() } override func run() { do { let target = try JMCTarget.createTargetFromJSONOnDisk() finishedExecutingOperationWithOutcome(.success(target)) } catch { finishedExecutingOperationWithOutcome(.error(error)) } } func finishedExecutingOperationWithOutcome(_ outcome: Outcome) { finishedExecutingOperation() onComplete(outcome) } }