Skip to content

Generating TSC declarations fails due to Metadata generator error w/specific imports #1233

@NickIliev

Description

@NickIliev

mobile platform: iOS
platform version : iOS 13, xCode 11.2.1
Desktop OS: macOS 10.14.6
NativeScript CLI version: 6.1.2
Framework used : Angular with TypeScript
Dependency: We are using the SDK PhotoEditor provided by Img.ly and available on cocoapods
The code source of their iOS native example is available here: https://github.com/imgly/pesdk-ios-examples

Summary:
When adding the cocoapod PhotoEditorSDK and running the the command $ TNS_TYPESCRIPT_DECLARATIONS_PATH="$(pwd)/typings" tns build ios, the typings files generated don't contain inheritance for the class PESDKPhotoEditViewController. When using the same cocoapod in a Native iOS example, the class PhotoEditoViewController inherits from ImglyKit.MediaEditViewController.

Steps to reproduce:

  • Create a simple helloworld NativeScript app
    $ tns create App1
  • Add a Podfile to the iOS app
    $ vi App_Resources/iOS/Podfile
platform :ios, '9.0'

target 'SwiftExample' do
  use_frameworks!
  pod 'PhotoEditorSDK', '~> 10.6.0'
end
  • Execute the command to generate the TypeScripts typings file
$ TNS_TYPESCRIPT_DECLARATIONS_PATH="$(pwd)/typings" tns build ios

Open the generated file typings/i386/objc!PhotoEditorSDK.d.ts

Expected: the class PESDKPhotoEditViewController inherits from PESDKMediaEditViewController (delcared in typings/i386/objc!ImglyKit.d.ts)

Actual: the class inherits from nothing

Description of the expected result
If you create an iOS native project with Xcode and add the same Podfile, you will see that the class PhotoEditViewController is described like this in the PhotoEditorSDK:

/// A `PhotoEditViewController` is the main starting point for the SDK. It displays the rendered
/// photo and a menu. It can present `PhotoEditToolController` objects and react to changes. It
/// can be presented on its own (thus displaying a toolbar for navigation at the bottom) or be
/// embedded into a `UINavigationController` (thus using the navigation controller's navigation bar
/// for navigation).
@available(iOS 9.0, iOS 9.0, *)
@objcMembers @objc(PESDKPhotoEditViewController) open class PhotoEditViewController : ImglyKit.MediaEditViewController, ImglyKit.BrandedView {
.....
}

Why it's an issue
We need to display a PESDKPhotoEditViewController in the view, and therefore it must inherit from UIViewController.

MediaEditViewController inherits UIViewController.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions