Closed alexi-cedric-roy closed 3 years ago
Hey mate - that's very interesting! Sorry to hear you're having issues with this...
Yes, you import the project into your source using import DSFStepperView
in your source file. Maybe you haven't set the target to import the library? In theory this should have occurred when you used Xcode to import the package, but check that DSFStepperView
has been added to the Frameworks, Libraries, and Embedded Content
setting (in your target settings).
I've just created a very simple macOS project in Xcode using DSFStepperView to see if I can reproduce what you're seeing, and I was able to successfully compile and run. I've uploaded the simple macOS testing app project (using Xcode 12.3) and the link is below.
Note that I just created a simple macOS storyboard project, then from Xcode menu File > Swift Packages > Add Package Dependency…
and then put https://github.com/dagronf/DSFStepperView
into the field for importing.
Would you mind trying downloading this project and running it?
Just something to remember - DSFStepperView is a macOS only control. This will not work in an iOS (or catalyst) app. You can import the module into an iOS app (Xcode will not stop you) but the code hides itself from non-macOS targets.
Cheers mate -- hope this helps! Enjoy your new Mac.
Darren.
Ah. Are you trying to use this from SwiftUI? (because you've mentioned ContentView.swift
)
I've just noticed that there is a bug in the SwiftUI implementation. The generated default initialiser for DSFStepperView.SwiftUI
is internal (one of the issues of developing for the bleeding edge is that SwiftUI changes quickly) - this means that using SPM to import will result in the initializer not being available.
I've updated the repo so that this issue is fixed. (if you update, you should see a new version 1.1.3
)
Note that this would not cause the issue that you're seeing (the module not importable).
If you download this project from GitHub, you will find some demos in the Demos
folder. You should be able to open and run these in Xcode 12.3.
Ahh yes I'm using swiftUI and it was showing me an error that I forgot about now, but sweet! And thanks for the quick reply, I'll look into other ways of importing it into my project, if possible!
Brilliant mate. Thanks for the feedback! Hopefully your issue is fixed by updating to 1.1.3
Just something to remember - DSFStepperView is a macOS only control. This will not work in an iOS (or catalyst) app. You can import the module into an iOS app (Xcode will not stop you) but the code hides itself from non-macOS targets.
I had somehow missed the part where you said that it was not meant for iOS, which is what i was trying to use it for, my bad!
All good! I've updated the README to make it more obvious (admittedly it wasn't very clear)
This is most likely an error from inexperience with mac on my part (I only got it 2 days ago), but after using the swift package manager to add this module as a dependency, I was unable to then import it as in ContentView.swift... Is "import DSFStepperView" the right way/name to import it? I've imported other dependencies without an issue, this is the only one so far which gives me the "No such module 'DSFStepperView'" error.