objc-bridging-header

10x worse Swift performance due to Obj-C bridging in framework?

ぐ巨炮叔叔 提交于 2020-01-24 00:01:10
问题 I'm working on a performance-intensive Swift app, with most of the fast code residing inside a framework. One of my expensive functions involves iterating over a two-million element array of structs. Unfortunately, the Obj-C bridge makes Swift Array performance about an order of magnitude slower than it should be. About 90% of my cycles are wasted on _ArrayBuffer._checkInoutAndNativeTypeCheckedBounds and bridging-related retains and releases. If I drop the framework and simply include those

Swift classes not found in Objective-C project

与世无争的帅哥 提交于 2019-12-13 13:58:07
问题 I am working on an iOS project developed using Objective-C. I need to integrate some Swift files in it. So, did following: Added a new Swift file named "temp", so that MyProject-Bridging-Header.h is added by my Xcode IDE (Version 9.1). Added the Swift files, which I want to use, to the project. Changed target setting Defines Module to YES. Similarly, "Product Module Name" is set to "MyProject". I can see the MyProject-swift.h a file name for the setting "Objective-C Generated Interface Header

Objective C bridging header file not found

南笙酒味 提交于 2019-12-11 07:36:44
问题 I have a class name AppState which is using a swift class object #import "Sonic-Swift.h" @interface AppState : NSObject @property (class) NSMutableArray<"Swift class" *> *entity; Now I need to use this class ( AppState ) in the swift file. So I'm trying to import this class in the bridging header. But after importing this file the app gives an error on the "#import "Sonic-Swift.h"" line "File not found". failed to emit precompiled header '/Users/krishna_mac_2/Library/Developer/Xcode

enum defined in Objc > Declared in Swift > to be used in Objc

 ̄綄美尐妖づ 提交于 2019-12-11 03:44:35
问题 I have a situation. I would appreciated if anyone has a solution for this I have an objC enum say Abc I declare this in a swift class, say, MySwiftClass.swift as var abc : Abc! I have created an instance of MySwiftClass ( mySwiftClass ) in another ObjC class (myObjC.m file) In myObjC.m, I’m trying to access enum Abc as mySwiftClass.abc . This is throwing an error - “Property ‘abc’ not found on object of type MySwiftClass *”. Basically the enum is not added as property in the “ProjectName

Include an extension for a class only if iOS11 is available

无人久伴 提交于 2019-11-30 09:41:19
I am trying to extend a class written in Obj-C and include an extension written in Swift that makes it conform to the UIDropInteractionDelegate , like so: @available(iOS 11.0, *) extension NoteEditViewController: UIDropInteractionDelegate { @available(iOS 11.0, *) public func dropInteraction(_ interaction: UIDropInteraction, sessionDidUpdate session: UIDropSession) -> UIDropProposal { let operation: UIDropOperation if session.localDragSession == nil { operation = .forbidden } else { // If a local drag session exists, we only want to move an // existing item in the pin board to a different

Include an extension for a class only if iOS11 is available

Deadly 提交于 2019-11-29 14:08:17
问题 I am trying to extend a class written in Obj-C and include an extension written in Swift that makes it conform to the UIDropInteractionDelegate , like so: @available(iOS 11.0, *) extension NoteEditViewController: UIDropInteractionDelegate { @available(iOS 11.0, *) public func dropInteraction(_ interaction: UIDropInteraction, sessionDidUpdate session: UIDropSession) -> UIDropProposal { let operation: UIDropOperation if session.localDragSession == nil { operation = .forbidden } else { // If a

Objective-C Bridging Header not getting created with Xcode 8

若如初见. 提交于 2019-11-27 18:43:00
I am trying to add objective-c libraries to my Swift 3 project (Xcode 8 IDE). But objective c interface header is not getting generated automatically. I tried to add bridging header manually but showing linking error saying bridging header .h is not found. Any help would be appreciated :) Augustine P A Here the solution for the issue. Create a new header file and name it like " your project name-Bridging-Header.h ". The file must be saved to your project folder Select your xcode project -> select your build target -> select build settings -> click the "all" option at the top -> search for

Objective-C Bridging Header not getting created with Xcode 8

ぃ、小莉子 提交于 2019-11-26 22:42:50
问题 I am trying to add objective-c libraries to my Swift 3 project (Xcode 8 IDE). But objective c interface header is not getting generated automatically. I tried to add bridging header manually but showing linking error saying bridging header .h is not found. Any help would be appreciated :) 回答1: Here the solution for the issue. Create a new header file and name it like " your project name-Bridging-Header.h ". The file must be saved to your project folder Select your xcode project -> select your