Skip to content

Commit

Permalink
Add label and warning about raw loops
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesper Sandström committed Apr 22, 2020
1 parent 7c9bc24 commit 3d8813e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion MobiusCore/Source/EffectHandlers/EffectRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,13 @@ public struct _PartialEffectRouter<Effect, EffectParameters, Event> {

/// Handle an the current `Effect` asynchronously on the provided `DispatchQueue`
///
/// Warning: Dispatching events to a loop from a different queue is not a thread-safe operation and will require
/// manual synchronization unless the loop is run in a `MobiusController`.
/// See: [Using MobiusController](https://github.com/spotify/Mobius.swift/wiki/Using-MobiusController).
///
///
/// - Parameter queue: The `DispatchQueue` that the current `Effect` should be handled on.
public func on(_ queue: DispatchQueue) -> Self {
public func on(queue: DispatchQueue) -> Self {
return Self(routes: routes, path: path, queue: queue)
}
}
Expand Down
2 changes: 1 addition & 1 deletion MobiusCore/Test/EffectHandlers/EffectRouterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class EffectRouterTests: QuickSpec {
var ranOnTestQueue = false
let connection = EffectRouter<Effect, Event>()
.routeCase(.effect1)
.on(testQueue)
.on(queue: testQueue)
.to {
dispatchPrecondition(condition: .onQueue(testQueue))
ranOnTestQueue = true
Expand Down

0 comments on commit 3d8813e

Please sign in to comment.