iOS Project utilizing Swift and PhoneGap/Cordova Framework

Currently, PhoneGap/Cordova for iOS is built on an ObjectiveC project.

Is it possible to run a PhoneGap/Cordova app using a Swift project instead?

Answer №1

Cordova-ios is primarily developed in Objective-C, and it seems unlikely that this will change in the near future. However, you do have the flexibility to incorporate Swift code alongside Objective-C within the same project, enabling you to create iOS plugins using Swift. To achieve this, you will need to include a bridging header. For a demonstration of how to create a Swift cordova plugin, check out this example.

Answer №2

The previous solution is effective but requires manual intervention.

If you want to automate the process of converting a project to Swift from Cordova's output, consider checking out this resource:

https://github.com/akofman/cordova-plugin-add-swift-support

This project includes a hook that executes after adding the platform, which automatically adds a bridging header and adjusts the necessary settings to ensure compatibility with Swift code. You can easily incorporate it as a plugin for convenience.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Unable to successfully display AJAX data on success

After successfully running my GradeCalc function in a MVC C# context with the grade parameter, I am facing an issue where the data is not displaying and the JavaScript alert pop up shows up blank. Can you assist me with this problem? $("#test").o ...

Guide on exporting member formModule in angular

After compiling my code in cmd, an error message is displayed: ERROR in src/app/app.module.ts(3,10): error TS2305: Module '"C:/Users/Amir_JKO/my-first-app/node_modules/@angular/forms/forms"' does not have an exported member 'formModul ...

Error 500 occurred when attempting to access an external PHP file

I am currently utilizing WP Web Scraper version 3.2. When I place the shortcode or template tag (php code) directly into my page, the plugin functions correctly and displays the values. However, when I attempt to include the template tag in an external php ...

What are the steps to installing and utilizing the Chart.js package on your local machine?

I thought installing chart.js on my Raspberry Pi would be a simple task, but I seem to be struggling with it. Due to the nature of my project, I need to have it installed locally rather than relying on an online version. Following the usual steps, I navig ...

Is it possible to create multiple text input components using the "each" function, and how can I update the state by combining all of them together?

I am looking to create a text-based word game where the length of each word changes with every level. Each letter will be placed in its own box, forming a matrix (e.g. 10 words, length: 10 => 10x10 matrix). How can I generate multiple text input compone ...

unable to display data through the web service

The functionality of this code is correct, but it seems to not be displaying records. When the record is retrieved from the file and shown in an alert, everything works fine. $j().ready(function(){ var result =$j.ajax({ ...

What is the significance of the -infinity value in the JavaScript console?

Recently, while learning JavaScript ES6, I came across a strange result of -infinity on my console when running the following code: let numeros = [1, 5, 10, 20, 100, 234]; let max = Math.max.apply(numeros); console.log(max); What does this ...

Create a nested array of subcategories within an array object

Currently, I am working on integrating Django Rest and Angular. The JSON array received from the server includes category and subcategory values. My goal is to organize the data such that each category has its related subcategories stored as an array withi ...

The child outlet becomes empty after refreshing the URL with the ID sourced from the {{link-to}} method in Ember.js

I am facing a strange problem where the child outlet becomes empty every time I refresh the page with the id. I have a generated list using the {{link-to}} helper. <script type="text/x-handlebars" id="twod"> <div class="row"> ...

The error message "res.jwt is not a function" is commonly encountered when using Node

I kept receiving the error message: res.jwt is not a function I have installed jwt-express and imported it like this: import jwt from 'jwt-express' This is my auth.js file: import Account from '../services/account.js' import env from ...

Variable unique to the specific function in universal function

Can you explain why the alert displays "AAA" instead of "BBB"? http://jsfiddle.net/Lp4cS/ var z = "AAA"; function xx() { var z = "BBB"; yy(); } function yy() { alert(z); } xx(); ...

Displaying a JQuery loading image on a webpage for a designated amount of time

I am trying to display an image in a div once a price calculation function is called. The image should cover the whole page. Can someone assist me with this? <div class="Progress_Layout" style="display:none"> <div class="Progress_Content"> ...

Is there a way to include the request body (req.body) in the msg object using express-winston?

My current challenge involves logging {{ req.body }} using the msg: object in express-winston. Even after whitelisting the body with expressWinston.requestWhitelist.push('body');, it still does not appear in the log. export const accessLogger = ...

What is the best method for transforming a stream into a file with AngularJS?

Currently, I have a server returning a file stream (StreamingOutput). My goal is to convert this file stream into an actual file using AngularJS, javascript, JQuery, or any other relevant libraries. I am looking to display the file in a <div> or ano ...

What is the most efficient method for updating dom handlers following the loading of new ajax content?

Currently, I am dealing with a large template that includes charts and other widgets. In addition to that, I manually integrated some ajax tabs. The issue arises when these tabs load new content (charts) because the template scripts in the head tag no long ...

How can I dynamically display a component in Angular using programming?

Is there a method in Angular to dynamically render a component into a DOM element using code? For instance, I know that in React you can utilize ReactDOM.render to transform a component into a DOM element. Is there an equivalent functionality available in ...

CloudFront for Amazon - Limit MP3 playback to designated website

I've been trying to find a solution for allowing mp3 files in an Amazon S3 bucket paired with Cloudfront to be streamed directly on my site without revealing the source URL of the mp3s. I want to prevent others from sharing or leeching the link by vie ...

Issue with UIPopoverController and UITapGestureRecognizer not functioning properly when placed inside ViewDidLoad

Whenever I include a UIPopoverController within the ViewDidLoad method, it results in an empty popover view being displayed. A similar issue arises when adding a UITapGestureRecognizer; the attached method fails to trigger. Moving the code to ViewDidAppear ...

Using JavaScript on an iPhone to automatically launch Safari when clicking on a link from a non-default iOS

When "googlechrome://www.lego.com" is opened in mobile Safari, it switches to the Google Chrome iOS app to open the URL. This feature allows for scriptlets like the following one, which enables you to open the current page in the Google Chrome iOS app from ...

Upon attempting to utilize Socket.io with Next.JS custom server, the server repeatedly restarts due to the error message "address already in

Every time I attempt to execute the refreshStock() function within an API endpoint /api/seller/deactivate, I encounter the following error: Error: listen EADDRINUSE: address already in use :::3000 at Server.setupListenHandle [as _listen2] (net.js:1318: ...