Rightpoint / BonMot

Beautiful, easy attributed strings in Swift
MIT License
3.54k stars 197 forks source link

Join sequence of composable into attribute string #329

Closed ZevEisenberg closed 6 years ago

ZevEisenberg commented 6 years ago

Closes #328

ZevEisenberg commented 6 years ago

@jvisenti I pushed an additional commit. Could you please have a look at it? I'm wondering whether it's confusing to have ["a", "b"].joined() be able to produce either a String or an NSAttributedString depending on type inference. cc @KingOfBrian

KingOfBrian commented 6 years ago

Good call on the oddity of having the overloads available, but I think it's fine. It may have an impact on compile times, but I doubt it's significant. It could be surprising to a user, but I'm not sure it's a big gotcha. I wonder if there's any guidance on providing overloaded methods.

jvisenti commented 6 years ago

I think in general the context will define the type and there won't be much ambiguity

ZevEisenberg commented 6 years ago

I also confirmed that, without any other context, ["a", "b"].joined() returns a String, so we should be OK.