bridging-header

Not able to import “project-name-Swift.h” file xcode

蓝咒 提交于 2019-12-11 03:58:22
问题 I have 2 files. "CodeInjection.m" #import <Foundation/Foundation.h> #import "BiplovCodeInjection-Swift.h" @interface CodeInjection: NSObject @end @implementation CodeInjection static void __attribute__((constructor)) initialize(void){ NSLog(@"==== Code Injection in Action==== with sniffer"); [[CodeInjectionSwift shared] performTask]; } @end My second file is. "BiplovCodeInjectionSwift.swift" import Foundation import NetworkInterceptor @objc class CodeInjectionSwift: NSObject { @objc public

@testable import and Bridging header don't work simultaneously

南笙酒味 提交于 2019-12-10 15:31:50
问题 I have Test target for my framework project which include: Obj-C tests Swift tests with @testable import to test internal classes and functions Some utils written in Obj-C for my tests which should be used in both 1) and 2) Since I want to use Obj-C utils I should add Bridging header to my test target to have access from swift sources. The problem is that @testable import doesn't work with Bridging header simultaneously: as long as I don't use Bridging header I have access to all internal API

Using cocoapods without use_frameworks! in swift

瘦欲@ 提交于 2019-12-10 13:43:49
问题 According to this tutorial, we should add use_frameworks! to Podfile in Swift project. But how to use third-party code in .m in the same project? One possible way is, Do NOT add use_frameworks! to Podfile Import header in ...-Bridging-Header.h Then, I can use third-party code in both .swift and .m file But when I try to import header in ...-Bridging-Header.h , it just throw *.h file not found error, how to fix this issue? 回答1: Past Up to CocoaPods 1.4.x (included), it was NOT possible to use

Include C++ header file in Swift

走远了吗. 提交于 2019-12-05 06:40:47
问题 I have a C++ header file (named header.h ) which I want to include into my Swift project. Since the C++ framework I want to include is not finished yet I just have the header file for now. My C++ header file header.h looks a little like this: #include <vector> struct someStruct{ float someAttr; } class someClass{ public: enum SomeEnum{ Option1, Option2 } void someFunc(const double value) {} } Problem is, when I try to include the header.h file in the project-Bridging-Header.h it will never

iOS mixed dynamic framework - bridge objc headers with private module

﹥>﹥吖頭↗ 提交于 2019-12-04 05:45:41
In regards to a "dynamic framework" target, I need to bridge internal (private) objective-c headers to my swift counterparts. From my understanding I need to use a private module. Some of these swift counterparts are bridged back to objective-c using the @objc class TheClass syntax. I've gone ahead and created a module.modulemap and a module.private.modulemap file in a directory under $SRCROOT and added the "necessary" flags to the build settings. SWIFT_INCLUDE_PATHS =>$(SRCROOT)/... I've also tried adding a "Private module map file" to the build settings My module map file is: module

Facebook SDK Swift - Use of undeclared identifier

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 23:13:22
问题 I am getting Use of undeclared identifier for every Facebook Object I use Following this tutorial: TUTORIAL: HOW TO SHARE IN FACEBOOK SDK 4.1.X FOR SWIFT But I've got the following error: I've added Facebook framework via cocoapods: pod 'FBSDKCoreKit' pod 'FBSDKShareKit' And it was installed successfully I've added bridging header #ifndef Bridging_Header_h #define Bridging_Header_h #import <FBSDKCoreKit/FBSDKCoreKit.h> #import <FBSDKShareKit/FBSDKShareKit.h> #endif /* Bridging_Header_h */ The

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

Cocoapods 1.0: Header files not found

强颜欢笑 提交于 2019-11-30 03:18:28
I just tried to update from cocoapods 0.39.x to Cocoapods 1.0. Running pod install from the terminal causes no warnings. Everything seems normal. However, when I try to build my project it outputs: AFNetworking/AFNetworking.h file not found My pod file looks like this (there are a few more dependencies but I only listed a part of it): platform :ios, '8.0' use_frameworks! source 'https://github.com/CocoaPods/Specs.git' target 'MyApp' do pod 'AFNetworking', '~> 2.6' pod 'BEMCheckBox' pod 'ActionSheetPicker-3.0', '~> 2.0.5' pod 'SCLAlertView' pod 'DZNEmptyDataSet' pod 'SSZipArchive' end target

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

Cocoapods 1.0: Header files not found

人盡茶涼 提交于 2019-11-28 23:52:28
问题 I just tried to update from cocoapods 0.39.x to Cocoapods 1.0. Running pod install from the terminal causes no warnings. Everything seems normal. However, when I try to build my project it outputs: AFNetworking/AFNetworking.h file not found My pod file looks like this (there are a few more dependencies but I only listed a part of it): platform :ios, '8.0' use_frameworks! source 'https://github.com/CocoaPods/Specs.git' target 'MyApp' do pod 'AFNetworking', '~> 2.6' pod 'BEMCheckBox' pod