objective-c-swift-bridge


Cannot access property on Swift type from Objective-C

女生的网名这么多〃 提交于 2019-12-27 11:44:21
问题 I am trying to access a Swift class's Double? property from Objective-C. class BusinessDetailViewController: UIViewController { var lat : Double? var lon : Double? // Other elements... } In another view controller, I am trying to access lat like following: #import "i5km-Swift.h" @interface ViewController () @property (strong, nonatomic) BusinessDetailViewController *businessDetailViewController; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self

how to send data from one ViewController to another which has SWRevealViewController

回眸只為那壹抹淺笑 提交于 2019-12-25 07:59:14
问题 I have impleented SWRevealViewController for sideMenu. My project is is Swift and SWRevealViewController is in Objective-c. SWRevealViewController is not initial view Controller.there is one intial View Contoller(1VC) and it has Push segue on SWRevealViewController. another ViewController (2VC) is act as FrontView. I want to pass data from (1VC) to (2VC). but I could not find any way 回答1: Two ways: In case of segue override func prepareForSegue(segue: UIStoryboardSegue!,sender: AnyObject!){ /

How do I remove a bridge header without getting errors?

自闭症网瘾萝莉.ら 提交于 2019-12-21 03:24:11
问题 I added a bridge header to my app the other day because I was trying to add Objective-C files to my Swift project. I was having trouble getting the connection to work(and I also did not know how to implement the Objective-C files), so I decided I wanted to start over again. I deleted the Objective-C files and the Bridge-Header file and now I am getting an error saying: <unknown>:0: error: bridging header '/Users/CalebKleveter/Documents/Development/iOS/personal/swift/Projects/Dicey/Dicey/Dicey

Correct way to catch NSInvalidArgumentException when using NSExpression [duplicate]

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-19 09:09:30
问题 This question already has answers here : Catch an exception for invalid user input in swift (3 answers) Closed 2 years ago . I want to validate user created expressions (like "2+2", "5+7" or more complex). I use NSExpression class to parse and calculate this expressions. This is my Playground code: import UIKit let string = "2+2" var ex:NSExpression? do { ex = NSExpression(format: string) } catch { print("String is not valid expression") } if let result = ex?.expressionValue(with: nil,

Failed to emit precompiled header for bridging header

三世轮回 提交于 2019-12-17 07:27:45
问题 I downloaded a project from GitHub, then pod the following files, some of which are written by OBJ-C and I used a bridge header. pod ‘SnapKit’ pod ‘MJRefresh’ pod ‘Alamofire’ pod ‘Kingfisher’ pod ‘MBProgressHUD’ pod ‘pop’ pod ‘EVReflection’ pod ‘StreamingKit’ pod ‘iCarousel’ pod ‘ReflectionView’ When I run the project with Xcode 9.0 beta 2, but unfortunately the error log as follows : error: failed to emit precompiled header '/var/folders/kd/4gh0_kxx3jx4thjb_sssmmcw0000gn/T/EvoRadio-Bridging

How to modify SWIFT_MODULE_NAME?

故事扮演 提交于 2019-12-17 05:12:04
问题 The title says it all. I've searched in the build settings for SWIFT_MODULE_NAME , and nothing came up. I've also searched online, and there are references to this name, but there is no information on how it is defined. Furthermore, I couldn't find any mention of SWIFT_MODULE_NAME in the Apple Docs. I do know this: it is used in the "Objective-C Generated Interface Header Name" build setting, and can be viewed by double-clicking on the settings value: $(SWIFT_MODULE_NAME)-Swift.h It is used

React Native Bridging: Passing JSON to Swift function

岁酱吖の 提交于 2019-12-10 23:55:25
问题 Im a rookie in Swift and Objective-C but Im trying to make a bridge from React Native to Swift, and send a JSON and a JSON Array as params to Swift. Inside React I would like to call this function: startTrack('some url string', { artist: 'Bruce Springsteen', title: 'Born in the USA' }, [{ url: 'url', type: 'image' }, { url: 'another url', type: 'link' ]}) So a string, an object, and a object array. In my bridge objective-c file i have this: RCT_EXTERN_METHOD(startTrack:(NSString *)url

React Native Bridging: Passing JSON to Swift function

一个人想着一个人 提交于 2019-12-06 13:57:43
Im a rookie in Swift and Objective-C but Im trying to make a bridge from React Native to Swift, and send a JSON and a JSON Array as params to Swift. Inside React I would like to call this function: startTrack('some url string', { artist: 'Bruce Springsteen', title: 'Born in the USA' }, [{ url: 'url', type: 'image' }, { url: 'another url', type: 'link' ]}) So a string, an object, and a object array. In my bridge objective-c file i have this: RCT_EXTERN_METHOD(startTrack:(NSString *)url trackinfo:(NSDictionary *)trackinfo slides:(NSDictionaryArray *)slides) And in my swift file i have tried a

Objective-C call Swift function

北战南征 提交于 2019-12-06 05:12:17
问题 Swift function defined in MySwift.swift File: func SomeSwift() { } SomeSwift() is not defined in any Swift class, it is just a pure function. After CMD + B to build the project, open Project-Swift.h , the SomeSwift() isn't show in there. Does the function in Swift have to be defined in some Swift class? and with @objc marked? like the following: @objc class SomeSwift: NSObject { func SomeSwift() { } } 回答1: Referring to Apple Documentation about Using Swift from Objective-C: A Swift class must

Objective-C call Swift function

百般思念 提交于 2019-12-04 11:14:58
Swift function defined in MySwift.swift File: func SomeSwift() { } SomeSwift() is not defined in any Swift class, it is just a pure function. After CMD + B to build the project, open Project-Swift.h , the SomeSwift() isn't show in there. Does the function in Swift have to be defined in some Swift class? and with @objc marked? like the following: @objc class SomeSwift: NSObject { func SomeSwift() { } } Referring to Apple Documentation about Using Swift from Objective-C: A Swift class must be a descendant of an Objective-C class to be accessible and usable in Objective-C Means that your class

工具导航Map