{"action":"created","issue":{"url":"https://api.github.com/repos/eddiekaiger/SwiftyAttributes/issues/29","repository_url":"https://api.github.com/repos/eddiekaiger/SwiftyAttributes","labels_url":"https://api.github.com/repos/eddiekaiger/SwiftyAttributes/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/eddiekaiger/SwiftyAttributes/issues/29/comments","events_url":"https://api.github.com/repos/eddiekaiger/SwiftyAttributes/issues/29/events","html_url":"https://github.com/eddiekaiger/SwiftyAttributes/issues/29","id":335263632,"node_id":"MDU6SXNzdWUzMzUyNjM2MzI=","number":29,"title":"Instantiating an NSMutableAttributedString while importing SwiftyAttributes causes build error on Xcode 10","user":{"login":"ketzusaka","id":1353840,"node_id":"MDQ6VXNlcjEzNTM4NDA=","avatar_url":"https://avatars1.githubusercontent.com/u/1353840?v=4","gravatar_id":"","url":"https://api.github.com/users/ketzusaka","html_url":"https://github.com/ketzusaka","followers_url":"https://api.github.com/users/ketzusaka/followers","following_url":"https://api.github.com/users/ketzusaka/following{/other_user}","gists_url":"https://api.github.com/users/ketzusaka/gists{/gist_id}","starred_url":"https://api.github.com/users/ketzusaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ketzusaka/subscriptions","organizations_url":"https://api.github.com/users/ketzusaka/orgs","repos_url":"https://api.github.com/users/ketzusaka/repos","events_url":"https://api.github.com/users/ketzusaka/events{/privacy}","received_events_url":"https://api.github.com/users/ketzusaka/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-25T05:25:23Z","updated_at":"2018-06-25T15:33:15Z","closed_at":null,"author_association":"NONE","body":"We've had this issue in our project preventing Xcode 10 compilation since the release. The error is:\r\n\r\n```\r\nFoundation.NSMutableAttributedString:11:12: note: found this candidate\r\n    public init(string str: String, attributes attrs: [NSAttributedStringKey : Any]? = nil)\r\n           ^\r\nFoundation.NSAttributedString:19:12: note: found this candidate\r\n    public init(string str: String, attributes attrs: [NSAttributedStringKey : Any]? = nil)\r\n```\r\n\r\nThe usage was pretty basic, something like so:\r\n\r\n```\r\nlet string = NSMutableAttributedString(string: \"Hello World\", attributes: [.strokeColor: UIColor.green])\r\n```\r\n\r\nAfter digging into it I discovered this doesn't happen unless we're importing SwiftyAttributes. If you duplicate the `testInit_withStringAndAttributes` test method, but replace the `NSAttributedString`s with `NSMutableAttributedString`s you'll get the same error when running the tests.\r\n\r\nAttempting to use the convenience initializer on a `NSMutableAttributedString` results in the following error:\r\n\r\n```\r\nCannot convert value of type '[Attribute]' to expected argument type '[NSAttributedStringKey : Any]?'\r\n```\r\n\r\nTaking out the convenience initializer on `NSAttributedString`, or giving the attributes parameter a different name resolves the issue.\r\n\r\nIt's likely that this is a bug with Swift. I'm not sure if you'd rather file a bug with them and see what happens, or resolve the issue within the library now. Changing the attributes parameter would be a breaking change and be cause for a major bump.\r\n\r\n\r\nLet me know if you're going to take action on this at the library level if ya can, as it is preventing us from building on XC10 :)\r\n\r\nHere's the diff w/ the fix and test that I experimented with:\r\n\r\n```\r\ndiff --git a/SwiftyAttributes/Sources/common/NSAttributedString+SwiftyAttributes.swift b/SwiftyAttributes/Sources/common/NSAttributedString+SwiftyAttributes.swift\r\nindex 76a0b01..6c3a934 100644\r\n--- a/SwiftyAttributes/Sources/common/NSAttributedString+SwiftyAttributes.swift\r\n+++ b/SwiftyAttributes/Sources/common/NSAttributedString+SwiftyAttributes.swift\r\n@@ -30,8 +30,8 @@ extension NSAttributedString {\r\n      - parameter    str:            The string for the new attributed string.\r\n      - parameter    attributes:     The attributes for the new attributed string.\r\n      */\r\n-    public convenience init(string str: String, attributes: [Attribute]) {\r\n-        self.init(string: str, attributes: dictionary(from: attributes))\r\n+    public convenience init(string str: String, swiftyAttributes attrs: [Attribute]) {\r\n+        self.init(string: str, attributes: dictionary(from: attrs))\r\n     }\r\n \r\n     /**\r\ndiff --git a/SwiftyAttributesTests/NSAttributedString_Tests.swift b/SwiftyAttributesTests/NSAttributedString_Tests.swift\r\nindex 60947b3..79845e4 100644\r\n--- a/SwiftyAttributesTests/NSAttributedString_Tests.swift\r\n+++ b/SwiftyAttributesTests/NSAttributedString_Tests.swift\r\n@@ -12,7 +12,7 @@ import SwiftyAttributes\r\n class NSAttributedString_Tests: XCTestCase {\r\n     \r\n     func testInit_withStringAndAttributes() {\r\n-        let subject = NSAttributedString(string: \"Hello World\", attributes: [.strokeColor(.green), .strokeWidth(3)])\r\n+        let subject = NSAttributedString(string: \"Hello World\", swiftyAttributes: [.strokeColor(.green), .strokeWidth(3)])\r\n         #if swift(>=4.0)\r\n             let expected = NSAttributedString(string: \"Hello World\", attributes: [.strokeColor: Color.green, .strokeWidth: 3])\r\n         #else\r\ndiff --git a/SwiftyAttributesTests/NSMutableAttributedString_Tests.swift b/SwiftyAttributesTests/NSMutableAttributedString_Tests.swift\r\nindex 5577b2e..f95aba3 100644\r\n--- a/SwiftyAttributesTests/NSMutableAttributedString_Tests.swift\r\n+++ b/SwiftyAttributesTests/NSMutableAttributedString_Tests.swift\r\n@@ -10,6 +10,16 @@ import XCTest\r\n import SwiftyAttributes\r\n \r\n class NSMutableAttributedString_Tests: XCTestCase {\r\n+\r\n+    func testInitMutable_withStringAndAttributes() {\r\n+        let subject = NSMutableAttributedString(string: \"Hello World\", swiftyAttributes: [.strokeColor(.green), .strokeWidth(3)])\r\n+        #if swift(>=4.0)\r\n+        let expected = NSMutableAttributedString(string: \"Hello World\", attributes: [.strokeColor: Color.green, .strokeWidth: 3])\r\n+        #else\r\n+        let expected = NSMutableAttributedString(string: \"Hello World\", attributes: [NSStrokeColorAttributeName: Color.green, NSStrokeWidthAttributeName: 3])\r\n+        #endif\r\n+        XCTAssertEqual(subject, expected)\r\n+    }\r\n     \r\n     func testAddAttributes_usingSwiftRange() {\r\n         let subject = \"Hello\".withTextColor(.orange)\r\n```"},"comment":{"url":"https://api.github.com/repos/eddiekaiger/SwiftyAttributes/issues/comments/399994687","html_url":"https://github.com/eddiekaiger/SwiftyAttributes/issues/29#issuecomment-399994687","issue_url":"https://api.github.com/repos/eddiekaiger/SwiftyAttributes/issues/29","id":399994687,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTk5NDY4Nw==","user":{"login":"ketzusaka","id":1353840,"node_id":"MDQ6VXNlcjEzNTM4NDA=","avatar_url":"https://avatars1.githubusercontent.com/u/1353840?v=4","gravatar_id":"","url":"https://api.github.com/users/ketzusaka","html_url":"https://github.com/ketzusaka","followers_url":"https://api.github.com/users/ketzusaka/followers","following_url":"https://api.github.com/users/ketzusaka/following{/other_user}","gists_url":"https://api.github.com/users/ketzusaka/gists{/gist_id}","starred_url":"https://api.github.com/users/ketzusaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ketzusaka/subscriptions","organizations_url":"https://api.github.com/users/ketzusaka/orgs","repos_url":"https://api.github.com/users/ketzusaka/repos","events_url":"https://api.github.com/users/ketzusaka/events{/privacy}","received_events_url":"https://api.github.com/users/ketzusaka/received_events","type":"User","site_admin":false},"created_at":"2018-06-25T15:33:15Z","updated_at":"2018-06-25T15:33:15Z","author_association":"NONE","body":"Yeah, I’ll open one once I get to the office :) \r\n\r\nThanks!"}}
{"actor":{"display_login":"ketzusaka"}}