-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swift support #284
Comments
If you are using Swift 1.2, yes you should use the swift12 branch. That stackoverflow article was written in 2010 and Swift was only announced in 2014. I use it like this (after cd'ing to the directory where the Core Data model file is): mogenerator --swift -m ModelFile.xcdatamodeld --base-class DDRManagedObject --base-class-import DDRCoreDataKit --output-dir ./ModelObjects but if you don't have a standard base class you want the mogenerator files to inherit from, then this should work for you: mogenerator --swift -m ModelFile.xcdatamodeld --output-dir ./ModelObjects Obviously replace ModelFile with the name of your Core Data model file. |
@dave256 👍 thanks for detailed explanation! It will be nice to mention it in readme, since there a new age of Swift is coming! 😉 |
@dave256 how can I install swift12 branch using brew? Can you help me? I'd like to switch my CD files to Swift..) |
I'm not an official maintainer - I've just provided a few patches to the swift12 branch. I don't know if it's possible to install a specific branch using brew. I initially installed it using brew, but forked and clone the repository to use the new branch. |
afaik, by brew it's not possible. |
@dave256 Hi Dave, curious what type of things you include in your base class. I never knew this was an option. Thanks |
Various convenience methods for fetching objects |
@dave256 Thanks |
How do I install the swift12 branch? I am using mogenerator 1.27 for awhile that I installed via a dmg. The new 1.28 DMG will not have this branch and from reading above, does not seem like it is possible via brew. I am just not sure of the technical steps to get the swift12 branch installed. Also, I am working on my new project that I am trying to be completely in Swift. There is mention of a to-one relationships... for anyone using this branch - how serious is it for development use? |
I agree with Danny and dave256, and would like an answer to both their questions: How would one install the swift12 branch in place of our existing (older) installation without homebrew, and what is this about to-one relationships? As the answer to both of these queries pertain rather heavily to my application, I would greatly appreciate a response. If no response is forthcoming—assuming either there is no known answer or people simply are unwilling to respond—then I'd still like some information to these ends. Any response at all would be of great assistance to myself, if not to others as well. Thanks in advance! |
@SilverEnderman to install without brew do the following in the Terminal app (bash shell): Open the .xcodeproj file in it and build it. I then went to the DerivedData directory I'm not sure what to one relationship issue you're referring to. HTH |
@dave256 Thanks for step-by-step tutorial! I found, that stable version is also support swift. |
Yes, thanks for the tutorial! Honestly, I'm not sure what to-one relationship issue I'm referring to either. I was wondering if there was such an issue, as I've heard tale recently of problems with mogenerator and Core Data to-one relationships. I'm fairly new to mogenerator, so if that problem doesn't exist, then I guess there's no point in me rambling on it further! |
@dave256 ... thanks so much for the instructions. So far I have cloned, checked out, built and copied (as mogeneratorSwift) to my /usr/local/bin. This was not to disturb by version 1.27 (I realize I am behind stable release) I am more familiar with svn. The only part I am not sure is the checkout of the swift12 branch. I saw no errors. $ git checkout feature/swift12 After all the build and copy ... $ mogenerator -version $ mogeneratorSwift -version So I am pretty confident I can begin to play with the mogen on my Core Data models. I will let you know if have any issues. |
@skywinder version 1.27 was released when Swift 1.0 was current. Apple made some changes to the language for Swift 1.2 so the feature/swift12 is to work better with Swift 1.2. You can read the changelog here: https://github.com/rentzsch/mogenerator/commits/feature/swift12 Again, I'm not an official maintainer so I certainly don't speak for the maintainers of the project. I just ran into some of the issues when trying to use version 1.27 with Swift 1.2 so I forked the repository, worked on fixing them, submitted pull requests, and they were accepted by one of the maintainers. Others have also contributed to the swift12 branch. |
👍 for getting |
I've been using |
Are ordered relationships just ignored by the current swift templates? I'm using the edit: Created #290 to represent this issue |
Hi. I quite confused about swift support.
https://github.com/rentzsch/mogenerator/blob/master/mogenerator.m#L726
I should write
--swift
option.there is no mention about swift at all.
--v3
option to generate in swift.There is also mention about some to-one relationships bug - is there issue related to this bug? how better to track resolution of this bug?
swift12
branch. Is it better to build your project from this branch to use it in swift project?The text was updated successfully, but these errors were encountered: