I installed SwifterSwift with cocoapods (I tried to drag & drop the Extensions folder before that, but the result was the same)
Well to start seeing and using the extensions
Although I see the inspectables in the storyboard, I don't see any of the public methods or properties after the . notation
I really like this library and the documentation for it. I want to use it in the future...so I really need your help!
Hi @XRadevFRT :)
Did you make sure to put the import SwifterSwift statement in the files you are trying to use the extensions?
Hm no, I didn't. Just dropped the Extensions folder in the project, wrote the import SwifterSwift but an error No such module 'SwifterSwift' appeared.
But its this normal? Importing a struct in to the file to use it? I mean even if its normal and I should import SwifterSwift to use the library features, there are 25+ public properties and 4 public methods that I can use from it...there is nothing more. I mean...its not the way extensions work.
I ended up drag & dropping only one .swift file from the extensions folder to my project. It works and I can see the extended functionalities. But I don't think this is the best approach either.
@XRadevFRT it may be bug in Xcode where you drop files into project but Target Membership is not set correctly for those files. @LucianoPAlmeida was talking about CocoaPods approach of installing SwifterSwift.
Try to drag & drop files again and then check if Target Membership is correct in File Inspector
After adding the import SwifterSwift the features started showing (this is with the cocoapods installation). I got to say this is strange to me. After all the main point of the extensions is the easy feature-usage.
Thank you!
I hope this issue can help others or if someone has a better approach will contribute to this issue.
Happy coding!
@XRadevFRT That's just how CocoaPods are designed to work.
Did you tried manual installation (drag & dropping of Sources folder) make sure that Copy items if needed is selected and select targets where you want to use extension. If you are using older version of Xcode it had bug where dropping multiple files into project and selecting targets didn't actually set targets (nothing was selected when you check Target Membership) for that file and extension are not visible because of that.
If Target Membership is set correctly you should be able to use extensions, try Date().nanosecond to see if it's available.
If it's working for you with CocoaPods approach you can keep using it. To make extensions available everywhere in code try to import SwifterSwift in AppDelegate.swift file.
I'm glad that you found solution that works for you ๐
Thank you @Najdan :)
@LucianoPAlmeida Thanks for the awesome library! :)
FWIW: that you have to import SwifterSwift either in the file you want to use it or in AppDelegate.swift was not obvious to me either and I spent 20 (frustrating) mins of checking and re-checking my Carthage install before finding this issue.
I'm new to Swift and so maybe it would be more obvious to more experienced developers, but a bit of documentation in the "Installation" section(s), would go a long way.
Thanks again. Cheers.
Hey @rfadams,
In name of all @SwifterSwift/contributors, we are glad you like it :))
And about the Installation additional information: Is noted and we can work on that as soon as possible ๐
But feel free to send a PR with this improvement if you like :))
Hi there,
Thanks, SwifterSwift is super awesome but I think you replied this message
to the wrong person. :)) My github handle is @rafalellys
rafalellys@gmail.com
Cheers! ;)
On Thu, 14 Feb 2019 at 05:13, Luciano Almeida notifications@github.com
wrote:
Hey @rfadams https://github.com/rfadams,
In name of all @SwifterSwift/contributors
https://github.com/orgs/SwifterSwift/teams/contributors, we are glad
you like it :))
And about the Installation additional is noted and we can work on that as
soon as possible ๐
But feel free to send a PR with this improvement if you like :))โ
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
https://github.com/SwifterSwift/SwifterSwift/issues/359#issuecomment-463605201,
or mute the thread
https://github.com/notifications/unsubscribe-auth/APeaVuvBeZ6MHY1gUZ2Z1AiPJ1zr_-Abks5vNVLRgaJpZM4RXiiB
.
Most helpful comment
@XRadevFRT That's just how CocoaPods are designed to work.
Did you tried manual installation (drag & dropping of Sources folder) make sure that Copy items if needed is selected and select targets where you want to use extension. If you are using older version of Xcode it had bug where dropping multiple files into project and selecting targets didn't actually set targets (nothing was selected when you check Target Membership) for that file and extension are not visible because of that.
If Target Membership is set correctly you should be able to use extensions, try
Date().nanosecondto see if it's available.If it's working for you with CocoaPods approach you can keep using it. To make extensions available everywhere in code try to
import SwifterSwiftinAppDelegate.swiftfile.I'm glad that you found solution that works for you ๐