{"action":"created","issue":{"url":"https://api.github.com/repos/square/Cleanse/issues/29","repository_url":"https://api.github.com/repos/square/Cleanse","labels_url":"https://api.github.com/repos/square/Cleanse/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/square/Cleanse/issues/29/comments","events_url":"https://api.github.com/repos/square/Cleanse/issues/29/events","html_url":"https://github.com/square/Cleanse/issues/29","id":170583416,"number":29,"title":"Advantage of using Tags","user":{"login":"startupthekid","id":3139429,"avatar_url":"https://avatars.githubusercontent.com/u/3139429?v=3","gravatar_id":"","url":"https://api.github.com/users/startupthekid","html_url":"https://github.com/startupthekid","followers_url":"https://api.github.com/users/startupthekid/followers","following_url":"https://api.github.com/users/startupthekid/following{/other_user}","gists_url":"https://api.github.com/users/startupthekid/gists{/gist_id}","starred_url":"https://api.github.com/users/startupthekid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/startupthekid/subscriptions","organizations_url":"https://api.github.com/users/startupthekid/orgs","repos_url":"https://api.github.com/users/startupthekid/repos","events_url":"https://api.github.com/users/startupthekid/events{/privacy}","received_events_url":"https://api.github.com/users/startupthekid/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-11T07:13:05Z","updated_at":"2016-08-23T20:03:03Z","closed_at":"2016-08-23T20:03:02Z","body":"This framework is fantastic but the one thing I can't wrap my head around is \r\n\r\nIn the example:\r\n\r\n```swift\r\nextension UIWindow {\r\n  struct Module : Cleanse.Module {\r\n    public func configure<B : Binder>(binder binder: B) {\r\n      binder\r\n        .bind(UIWindow.self)\r\n        .asSingleton()\r\n        .to { (rootViewController: TaggedProvider<UIViewController.Root>) in\r\n          let window = UIWindow(frame: UIScreen.mainScreen().bounds)\r\n          window.rootViewController = rootViewController.get()\r\n          return window\r\n        }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nand \r\n\r\n```swift\r\nextension RootViewController {\r\n  /// Configures RootViewController\r\n  struct Module : Cleanse.Module {\r\n    func configure<B : Binder>(binder binder: B) {\r\n      // Configures the RootViewController to be provided by the initializer\r\n      binder\r\n        .bind()\r\n        .to(factory: RootViewController.init)\r\n\r\n      // This satisfies UIWindow depending on TaggedProvider<UIViewController.Root>\r\n      // The actual root is our RootViewController wrapped in a UINavigationController\r\n      binder\r\n        .bind()\r\n        .tagged(with: UIViewController.Root.self)\r\n        .to { UINavigationController(rootViewController: $0 as RootViewController) }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nare equivalent to:\r\n- using `Provider<UINavigationController>` instead of `TaggedProvider<UIViewController.Root>`\r\n- removing `.tagged(with: UIViewController.Root.self)`\r\n\r\nWhat would the advantage of using tags be in this situation? Is it solely for API clarity? \r\n\r\nContinuing with the api url example used in the readme, I constructed some possible use cases for tags (as I understand them):\r\n\r\n```swift\r\nextension NSURL {\r\n    struct Primary: Tag {\r\n        typealias Element = NSURL\r\n    }\r\n    struct Github: Tag {\r\n        typealias Element = NSURL\r\n    }\r\n}\r\n\r\nstruct APIModule: Cleanse.Module {\r\n\r\n    func configure<B: Binder>(binder binder: B) {\r\n        binder\r\n            .bind()\r\n            .to(factory: APIModule.init)\r\n        binder\r\n            .bind()\r\n            .tagged(with: NSURL.Primary.self)\r\n             .to { NSURL(string: \"https://myapi.com\")!  }\r\n}\r\n\r\nstruct GithubModule: Cleanse.Module {\r\n\r\n    func configure<B: Binder>(binder binder: B) {\r\n        binder\r\n            .bind()\r\n            .to(factory: GithubModule.init)\r\n        binder\r\n            .bind()\r\n            .tagged(with: NSURL.Github.self)\r\n            .to { NSURL(string: \"https://github.com\")! }\r\n    }\r\n}\r\n```\r\n\r\nIs that a correct usage of tags? It seems a bit contrived, distinguishing between plain `NSURL` instances but I can see there being a value in tagging more complex classes.\r\n"},"comment":{"url":"https://api.github.com/repos/square/Cleanse/issues/comments/241858441","html_url":"https://github.com/square/Cleanse/issues/29#issuecomment-241858441","issue_url":"https://api.github.com/repos/square/Cleanse/issues/29","id":241858441,"user":{"login":"startupthekid","id":3139429,"avatar_url":"https://avatars.githubusercontent.com/u/3139429?v=3","gravatar_id":"","url":"https://api.github.com/users/startupthekid","html_url":"https://github.com/startupthekid","followers_url":"https://api.github.com/users/startupthekid/followers","following_url":"https://api.github.com/users/startupthekid/following{/other_user}","gists_url":"https://api.github.com/users/startupthekid/gists{/gist_id}","starred_url":"https://api.github.com/users/startupthekid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/startupthekid/subscriptions","organizations_url":"https://api.github.com/users/startupthekid/orgs","repos_url":"https://api.github.com/users/startupthekid/repos","events_url":"https://api.github.com/users/startupthekid/events{/privacy}","received_events_url":"https://api.github.com/users/startupthekid/received_events","type":"User","site_admin":false},"created_at":"2016-08-23T20:03:02Z","updated_at":"2016-08-23T20:03:02Z","body":"That makes perfect sense, thanks!"}}
{"actor":{"display_login":"startupthekid"}}