Adding a (Swift WatchKit) target to an (Objective-C iOS) app - objective-c

There are of course many sources of information about interoperability. However there are none specifically about adding a Swift WatchKit target to an Objective-C iOS project.
Of course normally in the iOS project we go to File -> New Target -> WatchKit app -> select Swift or Obj-C and you're done.
Usually adding Swift files to an Obj-C project just requires a bridging-header file and Xcode can create it for you but in my case I am not adding a file.
Lastly, I will be using WatchConnectivity of course with local and remote notifications plus sending data back and forth communicating between both apps. What else should I be aware of?

Related

Where is the native language setting for Swift or Objective-C in an existing Flutter project in Android Studio?

I've initially created a Flutter project with the native languages of Kotlin and Swift in Android Studio. Is there a way to change the native iOS language to Objective-C. This configuration only seems to occur on the creation of a Flutter project.
For iOS the difference is mostly in ios/Runner.xcodeproj/project.pbxproj
and some different source code files are generated in ios/Runner
(the differences are too many to list them here)
For Android the differences are in android/build.gradle, android/app/build.gradle, and different source code files are generated in android/app/src/main
To switch languages you can delete the ios and/or android directory and run
flutter create -i swift -a kotlin .
If you made manual changes in files in these directories you need to re-apply them.
If you commit a project to Git and then switch language (as explained above), then it's easy to see what the differences are exactly.
Don't delete the ios and android directories. doing so makes you loose all the changes and updates in your file. just this flutter create -i swift -a kotlin .
Don't forget the dot at the end , this specifies that you want to make the changes in the current directory not create a new one.
after you run this follow the instruction and your app will have Swift support for iOS and Kotlin for android.
To make sure that you have Swift support take a look at your runner folder and see if it contains
AppDelegate.siwft

Xamarin iOS binding library with multiple frameworks (native references) not working

I have 1 framework which is dependent on 2 other frameworks. For this, I created one binding library for iOS and included all three frameworks in it.
After creating this binding project, I included (added as reference project) it to a native iOS app. Now, the project(native) compiles without any error but the app doesn't run on the simulator. If I comment out the SDK code then app works perfectly. Not able to proceed further, what am I missing?
Update:
After below comments I checked frameworks again (just to be sure that my frameworks contain fat binaries). I found out that the frameworks in the visual studio project (path: ../ProjectName/ProjectName/obj/Debug) are smaller than the one that I imported and I am not able to see their package content also.

The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it

I want to submit app on AppStore, My app is having swift speech SDK library, and project is in Obj C, Whenever I am trying to upload my build, I am getting this error,Invalid Swift Support - The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it.
Doing Embedded Content Contains Swift Code -> YES in target setting, not working.
Incase your project is having swift classes /library:, Please ensure below settings are as follows:
Project/Target settings -> build Settings
1. Defines Module -> YES
2. Always embed Swift Standard libraries -> YES
It solved my problem.
In my case was because I was using an Adhoc provisioning profile instead of a production one when I was trying to deploy to the App Store Connect.

Can't import Firebase framework into iOS 8 Swift-based *framework*

I am trying to create a swift-based iOS 8 framework, and wanted to include Firebase framework into it. The instructions on Firebase site are only for importing Firebase into iOS apps, which uses bridging headers. Per Apple's instructions, bridging headers don't seem to apply to a Swift framework importing an Objective-C framework. I was looking at the Importing External Frameworks section on the Apple link. It specifies that: "When you import an external framework, make sure the Defines Module build setting for the framework you’re importing is set to Yes."
Despite that, I tried to manually create bridging header and adjusted Swift Compiler - Code Generation Building Settings, to no avail.
Would you know if the Firebase framework has Defines Module build setting set to Yes? If it does, then I'll keep digging into why I get "Use of unresolved identifier Firebase" after explicitly following Firebase instructions a few times. I am using Xcode 6 Beta 5. Any other suggestions and work-arounds are also deeply appreciated.
Here is a work-around I tried, that did not work:
In Xcode 6 Beta 5, I created a new Objective-C framework - SwiftFirebase. In it, I
imported Firebase framework, and the other five frameworks
set the -ObjC flag
copied references of all the .h files in Firebase Headers folder into the new framework - SwiftFirebase.
made those references from Project to Public
imported into the SwiftFirebase umbrella header
ensured that Defines Modules was enabled. It was, by default.
Build for Running.
Created a new Swift-based Framework: TestFramework to test the above SwiftFirebase, where I
Added SwiftFirebase from Debug-iphonesimulator into the new library
Created a new swift class
Imported SwiftFirebase
Added an init method, where I put in the sample swift code from Firebase quick-start.
Build for Running
Got an error compiling: "Firebase/Firebase.h not found"
My guess is that copying references of header files from a Firebase into another Objective-C framework and making them public is not an effective way of manipulating files. :)
Hate to wait for Apple's fix. Anything else I could try? Did I miss something in the above steps that you could think of? Many thanks!

Could not build module Foundation with Objective-C class in Swift

I'm attempting to compile a Swift app with supplementary Objective-C files loaded via the bridging header. However, it gets as far as the first line:
#import <Foundation/Foundation.h>
and shows the error:
Could not build the module 'Foundation'
I've checked that the Foundation framework is included but no luck. I've tried various combinations of deployment targets, architectures, etc too. Has anyone else experienced this in Xcode 6 beta 5?
Doc says
Any Objective-C framework (or C library) that’s accessible as a module
can be imported directly into Swift. This includes all of the
Objective-C system frameworks—such as Foundation, UIKit, and SpriteKit
so you could just do
import Foundation
You cannot import Obj-C-Headers in C-Files.
(If you are using c in your project).