I have added a framework to my xcode swift 4.x project. The framework was built using objective-c, is it not possible to set-up a bridging header w/ frameworks?
How will I be able to import my framework so I can start using its functionality?
Additionally, the project I'm using originally has a public cocoapod, I'm able to do the normal import PROJECT. But I have compiled the source to create a framework w/o the need of cocoapods, I have added the framework to the project, how will I be able to import it now in my swift classes?
Related
I've my own old framework which is only compatible in objective c, but Now I open in new xcode and added few swift classes (Xcode not gave me option to create bridging as this do in normal App when you add swift class in objective c project), Also Xcode gave me suggestion to update build setting and I updated those and currently I'm on Xcode 8.2.1. Now I try to build but I am getting few error as you can see in picture . I googled and found solution to delete derive data and quite xcode and open and clean. I done Everything but didn't workout.
Is bridging can be possible in framwork.
If not possible then how can I achieve.
Need help and suggestion.
When you are mixing Swift/Objc inside a framework, you can import Swift code for Objective-C use and import Objective-C from Swift.
First, ensure that Define Settings is set for the current framework target.
To import Swift into Objective-C:
In each Objective-C file that requires the Swift code, import the generated Swift header with the complete current Framework Path : #import <Framework/Framework-Swift.h>
To import Objective-C into Swift:
Ensure you have an umbrella header. The path can be found inside the Build Settings of the target. In this header, import all the needed Objective-C headers like normally in Objective-C: #import "Header"
Source: https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html#//apple_ref/doc/uid/TP40014216-CH10-ID122
I am developing an iOS application using Swift language. I want to use some framework in this application. There are some frameworks which can be installed using CocoaPods, so is there any way to use those frameworks without Cocoapods? Can I add them directly to my project?
Thanks..!
Yes you can. go to source file and check there will be .h and .m file for objective c.drag that file into your project and import it into header class and as per need you can use it
Hi Can any one help in resolving this issue.
I have created a dynamic framework in swift. My framework is referring some external frameworks like alamofire, xcglogger etc into my framework project. I am using carthage for this purpose.
It works perfectly. But when I create the framework and use it in another project its giving me error on my framework
Missing required modules : 'Alamofire','XCGlogger'
Can anyone help me in this.
I am using carthage 0.16.2
xcode 7.3.1
Swift
I have been looking everywhere and trying everything but I can't get this to work. I'm trying to create a Cocoa Touch Framework (in Swift) to share code between an iOS app I'm developing and its extension. All of the shared code relies on the NMSSH framework. I added the NMSSH framework to my framework, made sure it showed up in "Link Binary with Libraries" and that it was targeted at my framework. However, when I add #import <NMSSH/NMSSH.h> to my umbrella header, I get the error Include of non-modular header inside framework module 'MyFramework'.
In most of the places I have looked, they say the fix to this is to import the 3rd party framework in a .m file in my framework. The problem is that my framework is in Swift and thus doesn't have any .m files. I tried adding import NMSSH to my .swift file, but that just results in No such module 'NMSSH'.
There must be a way to actually get this to work without rewriting all of my code in Objective-C.
While creating a new project in "Xcode 6 beta", I noticed that there are no frameworks attached.
In Xcode 5.x, when we created a new project, we had the following frameworks linked by default:-
Foundation
CoreGraphics
UIKit
XCTest
The frameworks that are linked when you create a new SingleViewController project in Xcode 5.x
The MISSING frameworks when you create a new SingleViewController project in Xcode 6 beta
I do understand that this is a beta release of the IDE. But it will help if we come to know whether these frameworks are now linked internally?
Thanks in advance.
In Xcode 6, the default for new projects is to use the module system (introduced in Xcode 5) to automatically link any frameworks you reference in code via import (Swift) or #import/#import statements (ObjC). Because the project template contains code that imports Foundation and UIKit (and a test case target that imports XCTest), you get those frameworks linked automatically.
As Alladinian commented, there's a switch to enable or disable this in the project settings, so you can turn it on for old projects, too. (Or turn it off if it gives you trouble.). Once your frameworks are automatically linked, you don't need to put them in Linked Frameworks & Libraries anymore.
And if you want to start using other frameworks in your project, you don't need to add them I'm the project settings, either—just import MapKit or CloudKit or AVFoundation or whatever in your source code and they'll automatically get linked.