NativeScript: iOS: swift library added successfully, but can't reach any of the interfaces/classes/functions
I have been trying to run a swift library (https://github.com/davidstump/SwiftPhoenixClient) on an empty nativescript project. Everything compiles nicely, but when inside the app, it says: Can't find variable: SwiftPhoenixSocket
. I see that the libraries have downloaded from cocoapods successfully. What am I missing?
tns create test --ng
tns plugin add SwiftPhoenixClient
The hierarchy of the plugin:
- SwiftPhoenixClient – package.json – platforms —ios ----Podfile
// SwiftPhoenixClient package.json
{
"name": "SwiftPhoenixClient",
"version": "1.0.0",
"nativescript": {
"platforms": {
"ios": "2.5.0"
}
}
}
// Podfile
platform :ios, '9.0'
use_frameworks!
pod "SwiftPhoenixClient"
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
// app.component.ts
import { Component } from "@angular/core";
declare var SwiftPhoenixClient: any;
@Component({
selector: "ns-app",
templateUrl: "app.component.html",
})
export class AppComponent {
ngAfterViewInit(){
console.log("App running ...");
console.log(SwiftPhoenixClient);
}
}
// main apps package.json
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.test",
"tns-ios": {
"version": "2.5.0"
}
},
"dependencies": {
"@angular/common": "2.4.7",
"@angular/compiler": "2.4.7",
"@angular/core": "2.4.7",
"@angular/forms": "2.4.7",
"@angular/http": "2.4.7",
"@angular/platform-browser": "2.4.7",
"@angular/platform-browser-dynamic": "2.4.7",
"@angular/router": "3.4.7",
"SwiftPhoenixClient": "file:SwiftPhoenixClient",
"nativescript-angular": "1.4.0",
"nativescript-theme-core": "~1.0.2",
"reflect-metadata": "~0.1.8",
"rxjs": "~5.1.1",
"tns-core-modules": "2.5.1"
},
"devDependencies": {
"nativescript-dev-android-snapshot": "^0.*.*",
"nativescript-dev-typescript": "~0.3.5",
"typescript": "~2.1.0",
"zone.js": "~0.7.2"
}
}
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (5 by maintainers)
Thank you! This finally worked.
I do have additional errors now, regarding opening the socket itself with
open
, but I’ll ask them on your provided stage.