Rightpoint / BonMot

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

Argument passed to call that takes no arguments #348

Closed ServusJon closed 6 years ago

ServusJon commented 6 years ago

Any hints?

bildschirmfoto 2018-10-07 um 21 17 28
ZevEisenberg commented 6 years ago

@ServusJon would you mind posting which versions of Xcode, Swift, and BonMot you're using?

ZevEisenberg commented 6 years ago

I was not able to reproduce this in Xcode 10, Swift 4.2, iOS 12. The following code compiles fine:

let style = StringStyle(
    .font(UIFont(name: "Rubik-Medium", size: 16)!),
    .lineHeightMultiple(1.3)
)

let attributedString = "someString".styled(with: style)
UILabel().attributedText = attributedString

@ServusJon were you able to get this working? I'm wondering whether cleaning the project or deleting derived data might help. The code looks fine, which makes me suspect it could be an Xcode problem.

jaimeagudo commented 6 years ago

I get the same Argument passed to call that takes no arguments trying to rescue an old project, I upgraded to 5.3

  class func p2pGreen() -> UIColor    {
        //A6E22E
        return UIColor(red:0.65, green:0.89, blue:0.18, alpha:1.0)
    }

static let greenText = StringStyle(.color(.p2pGreen()))

I also get another unrelated error: Value of type 'String' has no member 'styled'

  return NSAttributedString.composed(of: [
            String(num).styled(with: .color(.white)),// greenText),
            " ",
            fbLabel.attributedText!.styled(with: iconStyle),
            (small ? "" : " friends".styled(with: .color(.white)))]
        )

Using Xcode Version 10.0 (10A255), Swift 3

I made sure the Pods->Target-> BonMot -> Swift Language Version is 4.2

Any help highly appreciated

s2imon commented 6 years ago

I've updated my project from an older version to latest version (Installing BonMot 5.3 (was 4.3.1)). And I'm getting the same errors that I can't get rid of. Any ideas?

Xcode 10.1, Swift 3, BonMOt 5.3

https://cl.ly/26c6e0c82ad7

I'm not sure where to get started. Thanks @ZevEisenberg ! Or did any of you in this thread got it figured out in the meantime @ServusJon @jaimeagudo? 🙌

others seem to be having the same problem described https://stackoverflow.com/questions/52665776/method-in-bonmot-cocoa-pod-not-recognised

ZevEisenberg commented 6 years ago

BonMot no longer supports Swift 3. Please try updating to Swift 4. (Apple is dropping Swift 3 in the next version of Xcode, so this is probably a good idea in general.) I tried supporting both Swift 3 and 4 in BonMot, but due to changes in NSAttributedString.Key, I wasn't able to make it work without duplicating the bulk of the code in the library, and given Apple's aggressive deprecation cycle, I decided it wasn't worth it at the time.

s2imon commented 6 years ago

@ZevEisenberg I apologise, that indeed seems to fix the issue for me! Thank you so much.