{"action":"created","issue":{"url":"https://api.github.com/repos/DianQK/blog-comment/issues/42","repository_url":"https://api.github.com/repos/DianQK/blog-comment","labels_url":"https://api.github.com/repos/DianQK/blog-comment/issues/42/labels{/name}","comments_url":"https://api.github.com/repos/DianQK/blog-comment/issues/42/comments","events_url":"https://api.github.com/repos/DianQK/blog-comment/issues/42/events","html_url":"https://github.com/DianQK/blog-comment/issues/42","id":220401891,"number":42,"title":"一些 RxSwift 思考题 - 回答 · 靛青K","user":{"login":"DianQK","id":10829914,"avatar_url":"https://avatars3.githubusercontent.com/u/10829914?v=3","gravatar_id":"","url":"https://api.github.com/users/DianQK","html_url":"https://github.com/DianQK","followers_url":"https://api.github.com/users/DianQK/followers","following_url":"https://api.github.com/users/DianQK/following{/other_user}","gists_url":"https://api.github.com/users/DianQK/gists{/gist_id}","starred_url":"https://api.github.com/users/DianQK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DianQK/subscriptions","organizations_url":"https://api.github.com/users/DianQK/orgs","repos_url":"https://api.github.com/users/DianQK/repos","events_url":"https://api.github.com/users/DianQK/events{/privacy}","received_events_url":"https://api.github.com/users/DianQK/received_events","type":"User","site_admin":false},"labels":[{"id":579422240,"url":"https://api.github.com/repos/DianQK/blog-comment/labels/2017/04/03/rxswift-answer/","name":"2017/04/03/rxswift-answer/","color":"ededed","default":false},{"id":579284104,"url":"https://api.github.com/repos/DianQK/blog-comment/labels/gitment","name":"gitment","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-04-08T14:07:23Z","updated_at":"2017-04-08T14:13:05Z","closed_at":null,"body":"http://localhost:4000/2017/04/03/rxswift-answer/\n\n"},"comment":{"url":"https://api.github.com/repos/DianQK/blog-comment/issues/comments/292720768","html_url":"https://github.com/DianQK/blog-comment/issues/42#issuecomment-292720768","issue_url":"https://api.github.com/repos/DianQK/blog-comment/issues/42","id":292720768,"user":{"login":"DianQK","id":10829914,"avatar_url":"https://avatars3.githubusercontent.com/u/10829914?v=3","gravatar_id":"","url":"https://api.github.com/users/DianQK","html_url":"https://github.com/DianQK","followers_url":"https://api.github.com/users/DianQK/followers","following_url":"https://api.github.com/users/DianQK/following{/other_user}","gists_url":"https://api.github.com/users/DianQK/gists{/gist_id}","starred_url":"https://api.github.com/users/DianQK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DianQK/subscriptions","organizations_url":"https://api.github.com/users/DianQK/orgs","repos_url":"https://api.github.com/users/DianQK/repos","events_url":"https://api.github.com/users/DianQK/events{/privacy}","received_events_url":"https://api.github.com/users/DianQK/received_events","type":"User","site_admin":false},"created_at":"2017-04-08T14:13:05Z","updated_at":"2017-04-08T14:13:05Z","body":"## `invokeMethod` 和 `sendMessage` 的区别\n\n`sentMessage` 和 `methodInvoked` 只有一个区别，`sentMessage` 会在调用方法前发送值， `methodInvoked` 会在调用方法后发送值。\n\n示例代码如下：\n\n```swift\noverride func viewDidLoad() {\n    super.viewDidLoad()\n\n    rx.sentMessage(#selector(ViewController.viewWillAppear(_:)))\n        .subscribe(onNext: { value in\n            print(\"1\")\n        })\n        .addDisposableTo(disposeBag)\n\n    rx.methodInvoked(#selector(ViewController.viewWillAppear(_:)))\n        .subscribe(onNext: { value in\n            print(\"3\")\n        })\n        .addDisposableTo(disposeBag)\n\n}\n\noverride func viewWillAppear(_ animated: Bool) {\n    super.viewWillAppear(animated)\n    print(\"2\")\n}\n```\n\n输出结果为：\n\n```\n1\n2\n3\n```\n\n不知道为何 😑 Markdown 的渲染在文章中会出问题，示例代码就写到评论了。\n\n> 正好测试一些 [Gitment](https://github.com/imsun/gitment)"}}
{"actor":{"display_login":"DianQK"}}