> On 3 Apr 2017, at 16:48, Adrian Zubarev <adrian.zuba...@devandartist.com> > wrote: > > Why do you cast against an existential in first place?
To avoid force-unwrap at the end here: class Store { var state: State // ... func processScheduledActions() { guard var effectfulState = state as? Effectful else { return } while let actions = effectfulState.scheduledActions.flush() { for action in actions { delegate?.store(self, didRequest: action) } } state = effectfulState as! State } } Thank you! R+
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users