-
Notifications
You must be signed in to change notification settings - Fork 5
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 version #1
Comments
Hi, you can try using it in your project as is. It is possible to use Swift and Objective C together: Although, it might not work, because I am using "method swizzling" technique. Not sure if it will work in Swift project. However, it is worth trying since it shouldn't be hard. |
I was aware of using Objective-C code in Swift via bridging headers and stuff but I wanted to go for a more pure Swift way :) I did a little bit of research and found that method swizzling is indeed possible in Swift as long as either the class is a descendant of Before explaining those, please have a look at the end result. The Swift equivalent to Objective-C categories is extensions so I implemented this as an extension.
Now finally the extension works. But the price of all these workarounds is reusability. Since there are hardcoded values and some parts of it spread across the app files, it's not a good, compact solution in Swift. Unless there is a way to get the swizzling code back into the extension itself. Anyway I uploaded a test Xcode project here if you wanna take a look at it and give it a try. I got help from StackOverflow to resolve some snags I hit on the way. |
Any updates on this? |
Hi, I know it's a bit old, but i just had this problem today, and maybe it can help someone. It seems that know it can be solved without swizzling or extension. Looks like this:
... And instantiate nav controller like this:
|
Hi! I'm currently facing this problem and while I was searching for a solution, I came across your category and it seems like just what I've been looking for.
Although the problem is I'm using Swift. Do you think you can convert it in to Swift?
The text was updated successfully, but these errors were encountered: