{"action":"created","issue":{"url":"https://api.github.com/repos/ReactKit/ReactKit/issues/51","labels_url":"https://api.github.com/repos/ReactKit/ReactKit/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/ReactKit/ReactKit/issues/51/comments","events_url":"https://api.github.com/repos/ReactKit/ReactKit/issues/51/events","html_url":"https://github.com/ReactKit/ReactKit/issues/51","id":97625929,"number":51,"title":"question - How to react?","user":{"login":"d6u","id":2153667,"avatar_url":"https://avatars.githubusercontent.com/u/2153667?v=3","gravatar_id":"","url":"https://api.github.com/users/d6u","html_url":"https://github.com/d6u","followers_url":"https://api.github.com/users/d6u/followers","following_url":"https://api.github.com/users/d6u/following{/other_user}","gists_url":"https://api.github.com/users/d6u/gists{/gist_id}","starred_url":"https://api.github.com/users/d6u/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d6u/subscriptions","organizations_url":"https://api.github.com/users/d6u/orgs","repos_url":"https://api.github.com/users/d6u/repos","events_url":"https://api.github.com/users/d6u/events{/privacy}","received_events_url":"https://api.github.com/users/d6u/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-28T06:21:07Z","updated_at":"2015-07-28T21:02:54Z","closed_at":null,"body":"I want a simple stream:\r\n\r\n```swift\r\nStream.sequence([1,2,3,4])\r\n            |> map { (n: Int) -> Void in\r\n                return n * 2\r\n            }\r\n            |> react { // use of unresolved identifier 'react'\r\n                println($0)\r\n            }\r\n```\r\n\r\nBut it said \"use of unresolved identifier 'react'\". I was confused how to apply `react`?\r\n\r\nAlso is it possible to construct a stream and dispatch change manually? E.g.\r\n\r\n```swift\r\nlet stream = Stream<String>()\r\nstream.map { ... }\r\n    .react { ... }\r\n\r\n// later on\r\nstream.dispatch(\"change\")\r\n```"},"comment":{"url":"https://api.github.com/repos/ReactKit/ReactKit/issues/comments/125753178","html_url":"https://github.com/ReactKit/ReactKit/issues/51#issuecomment-125753178","issue_url":"https://api.github.com/repos/ReactKit/ReactKit/issues/51","id":125753178,"user":{"login":"inamiy","id":138476,"avatar_url":"https://avatars.githubusercontent.com/u/138476?v=3","gravatar_id":"","url":"https://api.github.com/users/inamiy","html_url":"https://github.com/inamiy","followers_url":"https://api.github.com/users/inamiy/followers","following_url":"https://api.github.com/users/inamiy/following{/other_user}","gists_url":"https://api.github.com/users/inamiy/gists{/gist_id}","starred_url":"https://api.github.com/users/inamiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inamiy/subscriptions","organizations_url":"https://api.github.com/users/inamiy/orgs","repos_url":"https://api.github.com/users/inamiy/repos","events_url":"https://api.github.com/users/inamiy/events{/privacy}","received_events_url":"https://api.github.com/users/inamiy/received_events","type":"User","site_admin":false},"created_at":"2015-07-28T21:02:54Z","updated_at":"2015-07-28T21:02:54Z","body":"In current ver 0.11.4 (for Swift 1.2), `|>` is used for constructing stream-pipelining and not for activating (`react`) it, so you should use `~>` (or `~>!` for less operator precedence) instead.\r\n\r\n```swift\r\nStream.sequence([1,2,3,4])\r\n            |> map { (n: Int) -> Void in\r\n                return n * 2\r\n            }\r\n            ~>! react {\r\n                println($0)\r\n            }\r\n\r\n// or, use plain dot-syntax `.react()`\r\nlet stream = Stream.sequence([1,2,3,4]) |> map { ... }\r\nstream.react { ... }\r\n```\r\n\r\nBTW, I'm planning to remove these custom operators in future, since constrained extensions will be supported in Swift 2.\r\n\r\nFor manual dispatching stream (like Rx.Subject), unfortunately there's no class available now.\r\nBut easy alternative would be to create some `dynamic var` property and create its KVO stream."}}