Commit a1cf000b authored by Toby Brennan's avatar Toby Brennan
Browse files

Fix some compiler warnings for double-wrapped optionals (using flatMap)

parent ffd068fb
Showing with 4 additions and 3 deletions
+4 -3
......@@ -288,7 +288,7 @@ public class Action: HashableClass, CVUToString {
}
func get<T>(_ key: String, _ viewArguments: ViewArguments? = nil) -> T? {
let x: Any? = values[key] ?? defaultValues[key] ?? baseValues[key]
let x: Any? = values[key] ?? defaultValues[key] ?? baseValues[key].flatMap { $0 }
if let expr = x as? Expression {
do {
expr.lookup = context.views.lookupValueOfVariables
......@@ -1131,11 +1131,12 @@ class ActionRunIndexerRun: Action, ActionExec {
self.context.podAPI.runIndexerRun(uid) { error, data in
print(error)
error.map { print($0) }
print(data)
}
#warning("@Ruben - I saw this incidentally... this timer needs to be stored in a property somewhere or it won't work as expected")
Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { timer in
let timePassed = Int(Date().timeIntervalSince(start))
print("polling indexerInstance")
......@@ -1216,7 +1217,7 @@ class ActionSetProperty: Action, ActionExec {
throw "Exception: property is not set to a string"
}
subject.set(propertyName, arguments["value"])
subject.set(propertyName, arguments["value"].flatMap { $0 }) // Flatmap removes the double optional
// TODO: refactor
((context as? SubContext)?.parent ?? context).scheduleUIUpdate()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment