How to make html file visible in main app knowing that the html file is inside a module?

47 Views Asked by At

I have a swift iOS app modularized.

I want to show a youtube video inside the main app with the implementation done inside a module. I get the error below inside the main app when I execute the app and try to reproduce the video.

Fatal error: Unexpectedly found nil while unwrapping an Optional value

I have the function below inside my module and it works inside the module.

    fileprivate func playerHTMLPath() -> String {
        return bundle.path(forResource: "YTPlayer", ofType: "html")!
    }

bundle is declared this way:

let bundle = Bundle(for: YouTubePlayerView.self)

When I execute the module inside the main app, that function fails with the above error.

Below I show you my podspec inside the module.

Pod::Spec.new do |spec|

  spec.name         = "Training"
  spec.version      = "1.0.15"
  spec.summary      = "My Private Library Training to learn."

  spec.description  = <<-DESC
  It is a private library only for learning purpose
                   DESC

  spec.homepage     = "https://[email protected]/name/treinos"

  spec.license      = { :type => "MIT", :file => "LICENSE" }

  spec.author        = { "name" => "[email protected]" }

  spec.platform = :ios, "13.0"
  spec.swift_version = "5.0"

  spec.dependency 'Router', '1.0.9'
  spec.dependency 'CommonView', '1.0.25'
  spec.dependency 'DGCharts', '5.0.0'

  spec.source       = { :git => "[email protected]:namex/treinos.git", :tag => "#{spec.version}" }

  spec.source_files = "Training/Training/**/*.{m,h,swift}"
  spec.resources = ['Training/Training/Assets.xcassets']

end

Could you tell me please what should I do inside the podspec or anywhere else to reproduce the video inside the main app with the implementation done inside the module?

*my module is a framework.

0

There are 0 best solutions below