Importing TZStackView in an objective - c project - ios

I am trying to use TZStackView due to limitations of UIStackView but since it's written in swift, I can't add it to my project which is Objective-c project. I've added swift class to objective-c projects before but this doesn't seem to work. I've copied TZStackView files to my project directory and got like hundreds of error messages. How do I use it ( I don't wanna use pods)?

Use the TZStackView v1.2.0, TZStackView v1.3.0 supports swift 3 it will works only in xcode8. for xcode7 use TZStackView v1.2.0.

Related

Updating Xcode cause fail in loading frameworks

I have updated my Xcode Client to 10.0 and installed all components. Now i have 9 errors in my project (a Swift project, that needs to be converted to Swift 4.2).
I use Facebook and Vuforia framework, and it seems like the problem lies there. I have tried to update the Pods, but this make no difference.
It is like the frameworks cant be read properly, because they are not converted yet. But i cant convert to Swift 4.2 as long as the build faild. Do i need to update the frameworks somehow?

How to use a POD which is compiled in Swift 3.0, into a Project made in 2.2?

I made my project in 2.2. Now I want to use a library which is compiled in 3.0. how can I use it.
I tried making legacy to NO and YES, and Unspecified, but not working. If I do Yes, it gives lots of errors as code is in 3.0, and I want 2.2 as base.
NOw what should I do
pod 'EZSwipeController'
Its screenshot of document.
This is library
The answer to this is pretty simple: You can't mix Swift 2 and Swift 3 codebases. Either you upgrade your project to Swift 3 (which probably makes sense anyways), or you backport the library you want to use to Swift 2.
You can do this, I am using a Swift 2.2 code in my project and i have installed EZSwipeController using pods and project is running successfully.
Here is what you needs to be done,
First select your Project
Check the screenshot
Then in the Build setting for the target set Use Legacy Swift Language Version to yes, like this
Now from the side navigation select Pods and then select EZSwipeController, like this
set Use Legacy Swift Language Version to yes.
By making this changes it will work.

Is it possible to use libraries written in an old version of swift in a project with a newer version of swift?

I'm working on a project in Swift 3. However, many libraries are still using Swift 2.3.
Is there a way of making use of them in my project as they are?
Since it's possible to use Objective C libraries in Swift, I figure there's a chance.
Maybe this reference from Apple answers the question:
unfortunately it would seem to be impossible:
First, Swift 2.3 and Swift 3 are not binary compatible so your app's entire code base needs to pick one version of Swift.
https://developer.apple.com/swift/blog/?id=36

Integrate Swift into an exported Unity project instead of using Objective C?

I am currently starting an iOS project and I want to use Unity as the primary drive for the project. Currently when you export Unity as an exported project, I am only given Objective-C.
How do I make a Unity based project using primarily Swift?
This seems extremely complicated as Objective-C can develop in top level and most of Unity is involved with the top level, how can I use Swift in this project? I am planning on using most of the Unity in Objective C and most of the front end GUI on Swift.
After a good couple of days hammering at this, it is possible. The main pitfalls was of course how the linking and the compilation process that Objective-C and Swift have to interact in order to do so:
Create an AppDelegate in Swift, subclassing UnityAppController and utilizing startUnity instead of Application(..)
Bridge between Swift and ObjectiveC using Unity's generated main.mm and the bridging headers
Create an Objective-C wrapper whose sole responsibility is to communicate between the Swift project and the Unity project
As follows here: https://apollowprogrammingblog.wordpress.com/2015/08/17/how-the-heck-do-you-integrate-swift-and-unity/
UPDATE July 11th 2016: There is also another guide, which I have since started using for my app development moving forward: https://github.com/blitzagency/ios-unity5. This is a different approach and also largely more maintainable due to the easily configurable unity.xcconfig (To get through most of the project config headaches) strat used here

Can we create iOS app with swift and obj c both?

Can we create iOS app with swift and obj c both.My half app is made using OBJ-C and just want to improve apps performance so is that possible to use swift in between
Yes you can.
You have to add objc header #imports in the <module name>-Bridging-Header.h that you want to make available in swift, and you can use swift code from objc by importing the <module name>-Swift.h file in your objc code.
Note that the latter header file is automatically generated when building, and it is not visible in the project navigator - but you can open it by cmd+click-ing its name in an existing #import. Also to note that if compilation fails, most likely the file will not be generated.
Last, I highly recommend that you avoid circular references between objc and swift - for instance, creating a SwiftClass, inherited from BaseObjcClass, and using SwiftClass from objc - I've experienced that it doesn't work (compilation errors), and I am not aware of any workaround
Yes, you can. You just need to follow this:
https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html
Apple’s intention to replace the Objective-C language using Swift, it is not practical in the short term simply due to the fact that developers are deeply entrenched in Objective-C. Rather than force Swift down the developer’s throat, Apple has made it easy to allow Objective-C to interoperate with Swift.
http://mobiforge.com/design-development/using-objective-c-and-swift-together-ios-apps
Dec 2018 - I found this useful YouTube video that helps explain what files you need to add and how to make the connections.
YouTube - How to use Swift and Objective-C in the same project

Resources