Xcode can't read swift files - ios

This project came to me to be updated to the new iOS 10.It uses frameworks downloaded with cocoa pods. Some of these frameworks are written in swift.Now that I made few changes on the project code, when I try to build the project, I get errors on the frameworks I downloaded as if the project can't read swift!
Is there somewhere where I can set my project to accept swift classes?

Updated Xcode to Xcode 8 and it updated the code and fixes theses issues. Thanks Folks.

Related

Xcode 10 convert to Swift 4.2 fails

I am getting this error trying to migrate to Swift 4.2 using the Xcode provided conversion tool. How do I fix it? The code builds fine otherwise.
Do you have any libraries in your project? I think you are trying to covert your project with dependencies and there are problems in them with new swift version. Try to uncheck all dependencies except your project and convert to new version of Swift
I had similar problem, solved it by
1- Change swift lang version in build setting of all app and test targets to 4.2
2- build app, errors will happen like UIControlState renamed to UIControl.state
3- fix all of the build errors
4- I updated all recommended settings by xcode
5- then I asked xcode to convert to swift4.2
It's always a good idea to upgrade all dependencies (e.g. via Cocoapods) to its latest version that support Swift 4.2. In my case, I also need to manually change the Swift Language Version build settings for a pod library from Swift 4 to Swift 4.2 as that lib uses some APIs in 4.2 only.
I have problem too. I find solution to fix this problem in web
https://ericasadun.com/2018/09/13/converting-projects-by-hand-to-4-2/
First
You try delete pod in pod file and install pod again and pod update in your folder project in command then conversion to Swift 4.2.
if it's not work do this in second.
Second
you try follow do this picture in build setting project or try follow do in link web.
As described here,
There may have been issues with processing the targets that will
negatively impact the migration process. Switch to the Report
Navigator and select the Convert entry that was added; this is the
conversion build log. Check the log for errors that may have showed
up.
If you see errors about not being able to code-sign the target, try
disabling code-signing from the build settings of the target. If you
see other errors, please file a bug report and include the details.
You are strongly encouraged to attach a project that illustrates the
faulty migration if possible.

Xcode 9 can't find header from built-in framework, but it exists there

I have an iOS project, it can be compiled with Xcode 8.
I updated Xcode to 9 recently, it can't be compiled with errors below:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImage.h:16:9: 'IOSurface/IOSurfaceRef.h' file not found
I noticed IOSurface is needed, so I added IOSurface.framework in Build Phases, but I still got this error.
In project hierarchy, IOSurface.framework is in Frameworks folder, IOSurfaceRef.h is there after expanding this framework.
Finally, this problem is coming from thirdparty, their sdk has a framework names IOSurface.framework, that's why headers can't be found.

Issue with building project after addition of AFNetworking in Xcode 8

I just added AFNetworking in my project and have this problem.If you will say that I need to add a security.framework I will answer that I did it already.Here is screenshots. Problem screenshot
I have already added framework screenshot
On screenshot I see that you added Apple Security.framework, and problem is with AFNetworking framework. Are you sure that you added AFNetworking to your project. If it was also added - then next question comes:
Was CocoaPods used for this, or there was another source. CocoaPods should install newest version of framework but if framework is for example copied from older project - then it can cause many issues. For example framework may not support arm64 architecture.
So first attempt to solve this problem will be using fresh version of framework (using CocoaPods recommended), eventually check architectures supported by framework (see here).
Clean your build folder and run pod install.

Adding Framework and App as the target for same Xcode project

I have a Xcode project released on the app-store. Now I want to create a framework with some part of the app to be used by other users.Also I want to reference the same file which are common between app and framework so that any modification done should not be done twice(once in framework file and next in app file).What will be the best approach to do it? Shall I create a separate Xcode project and add those files by unchecking the option copy items if needed? Or can I add one more target in Xcode project as framework?
Please help.
you can use frameworks or CocoaPods.
you can find how create iOS Framework here.
For CocoaPods see raywenderlich tutorial
hope this will help you.
This source may help in you making reusable modules in a drag and drop framework

How do I use Realm in a Swift Playground?

So, I'm pretty new to XCode development, but I've read the documentation on how to import third party frameworks into a Playground in XCode 7.1.1, and the documentation on how to get started with Realm, using the Dynamic Framework method of installation.
At this point I have a workspace that contains an iOS project, the two .framework folders required by Realm, and a Playground project. I have built the workspace without errors.
I figured going through some of the Realm examples in the Playground would be a great way to get going, but doing a simple:
import RealmSwift
results in a "No such module 'RealmSwift' error. What am I missing?
You should install Realm with Cocoapods.
One good practice to adopt is using Cocoapods when using other librairies like this one when they support it. That way you always have control on the version you're using of this library.
Update: Realm Swift works with Swift Playgrounds now. You'll find an example in Realm's release zips (direct download).
Realm doesn't support Swift Playgrounds at the moment: https://github.com/realm/realm-cocoa/issues/938
I faced the same issue while playing with RealmSwift on a Playground. I create it under a single view iOS application. Fixed it after building my main target, as creates the dynamic framework to be linked into the Playground.
Working fine with Cocoapod installation, Swift 4.2, & Xcode 10.1
Try it yourself. https://github.com/sauvikdolui/RealmExploration

Resources