You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Mahendra Liya <li...@gmail.com> on 2023/07/14 18:10:40 UTC
How to add Cordova to an existing project progmatically for iOS
Hello,
I've an existing Swift Project which doesn't use Storyboard or XIBs. All
the UI Screens are programmatically coded. Instead of adding a simple
webview, I was inclined towards adding Cordova instead.
I was wondering if it's documented anywhere (which I couldn't find though)
if Cordova can be programmatically added to an existing Swift (not
Objective-C though) project and if so, how please?
I was wondering doing something like this:
- Adding CordovaLib to the project and then
*let* cordovaView = CDVViewController()
// any other configuration / initialization that may be required for
Cordova to work properly
*self*.view.addSubview(cordovaView)
Any advice or insights would be greatly appreciated.
Cheers,
Mahendra
Re: How to add Cordova to an existing project progmatically for iOS
Posted by Mahendra Liya <li...@gmail.com>.
Thank you, Darryl!
I didn't mean to ask for user support, so sorry if my message gave that
impression. I was hoping for some technical discussion around this. And
also touchbase and explore if there are any plans to migrate to Swift as
CordovaLib, as I see in the CordovaLib project, is still in Objective-C. I
did a minor contribution on cordova-android in the previous release for the
android platform and was willing to contribute to iOS, if any assistance
would help in migration to Swift.
But thank you for sharing the link to the old docs and your mention about
Swift Package :)
Cheers,
Mahendra
On Sat, Jul 15, 2023 at 12:36 AM Darryl Pogue <da...@dpogue.ca> wrote:
> Hi Mahendra,
>
> This mailing list is primarily focused on development work of Cordova
> itself, rather than user support. You might get more response posting on
> the Cordova community GitHub Discussions:
> https://github.com/apache/cordova/discussions
>
> That said, embedding a Cordova WebView in an existing project is
> supported, although not particularly well-documented.
> There are some old docs here:
> https://cordova.apache.org/docs/en/11.x/guide/platforms/ios/webview.html
>
> One exciting new development is that CordovaLib in cordova-ios 7.0.0 is
> available as a Swift Package, which should allow you to skip the steps
> about Carthage and Cleaver and adding CordovaLib.xcodeproj as a subproject
> to Xcode.
> You can simply add "https://github.com/apache/cordova-ios.git" in Xcode
> as a package dependency, with a tag of "rel/7.0.0" to get the latest
> version.
>
> Hope that helps to steer you in the right direction,
> ~Darryl
>
> On Fri, Jul 14, 2023 at 11:11 AM Mahendra Liya <li...@gmail.com>
> wrote:
>
>> Hello,
>>
>> I've an existing Swift Project which doesn't use Storyboard or XIBs. All
>> the UI Screens are programmatically coded. Instead of adding a simple
>> webview, I was inclined towards adding Cordova instead.
>>
>> I was wondering if it's documented anywhere (which I couldn't find though)
>> if Cordova can be programmatically added to an existing Swift (not
>> Objective-C though) project and if so, how please?
>>
>> I was wondering doing something like this:
>>
>> - Adding CordovaLib to the project and then
>>
>> *let* cordovaView = CDVViewController()
>>
>> // any other configuration / initialization that may be required for
>> Cordova to work properly
>>
>> *self*.view.addSubview(cordovaView)
>>
>>
>>
>> Any advice or insights would be greatly appreciated.
>>
>> Cheers,
>> Mahendra
>>
>
Re: How to add Cordova to an existing project progmatically for iOS
Posted by Darryl Pogue <da...@dpogue.ca>.
Hi Mahendra,
This mailing list is primarily focused on development work of Cordova
itself, rather than user support. You might get more response posting on
the Cordova community GitHub Discussions:
https://github.com/apache/cordova/discussions
That said, embedding a Cordova WebView in an existing project is supported,
although not particularly well-documented.
There are some old docs here:
https://cordova.apache.org/docs/en/11.x/guide/platforms/ios/webview.html
One exciting new development is that CordovaLib in cordova-ios 7.0.0 is
available as a Swift Package, which should allow you to skip the steps
about Carthage and Cleaver and adding CordovaLib.xcodeproj as a subproject
to Xcode.
You can simply add "https://github.com/apache/cordova-ios.git" in Xcode as
a package dependency, with a tag of "rel/7.0.0" to get the latest version.
Hope that helps to steer you in the right direction,
~Darryl
On Fri, Jul 14, 2023 at 11:11 AM Mahendra Liya <li...@gmail.com>
wrote:
> Hello,
>
> I've an existing Swift Project which doesn't use Storyboard or XIBs. All
> the UI Screens are programmatically coded. Instead of adding a simple
> webview, I was inclined towards adding Cordova instead.
>
> I was wondering if it's documented anywhere (which I couldn't find though)
> if Cordova can be programmatically added to an existing Swift (not
> Objective-C though) project and if so, how please?
>
> I was wondering doing something like this:
>
> - Adding CordovaLib to the project and then
>
> *let* cordovaView = CDVViewController()
>
> // any other configuration / initialization that may be required for
> Cordova to work properly
>
> *self*.view.addSubview(cordovaView)
>
>
>
> Any advice or insights would be greatly appreciated.
>
> Cheers,
> Mahendra
>