Hi I just found out that it is possible to create Flutter project with Swift and Kotlin. However, I'm already invested in my current projects and want to recreate the ios and android as Swift and Kotlin (currently they are default to Java and ObjC).
Thanks.
use -i and -a to create new project, like this:
flutter create -i swift -a kotlin project_name
see also:https://docs.flutter.dev/development/platform-integration/platform-channels#example-project
then replace with lib folder from old project.
update 2020.01.13
swift and kotlin are default now. you can use those command to update exist project:
cd project
flutter create .
this command will update your project. then you can merge you old code into new project, and remove old code.
make sure you backup your project before run it, and you know what are you exactly doing
You can also run flutter create -i swift . inside your app folder, to regenerate ios folder.
I've not tested android, but I guess the same should work for it too - flutter create -a kotlin .
I just deleted default ios and android folder in my flutter project.
now in order to generate these default folder again you can use this below command :
flutter create .
Note : "." is also part of command , also make sure that your project folder name should not contain spaces or special characters which are invalid for package name.
Related
I'm creating an iOS framework and I want to copy some Xcode templates from my framework directory (that are not included in my .xcproject, but are in the folder that contains the project), when my framework is installed trought Cocoapods. In other words, when a developer installs my framework with Cocoapods or manually, I want to copy the templates into his Xcode Template Files folder.
I'm trying to execute a swift script file from the build phase of Xcode like this:
swift "${SRCROOT}/Folder/Folder/installer.swift"
But I get this error when I try to build it:
/<unknown>:1:1: module 'Swift' was created for incompatible target x86_64-apple-ios13.0: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule
If I execute swift installer.swift from the terminal, the script works. So, I think there is a problem with my Xcode.
My installer.swift file copies the template files to the Xcode Template Files folder.
I don't know if this way is the correct one, but I didn't find any other solution so far.
When I tried something similar I had to tell swift to compile for macOS by adding the following "shebang" comment as the first line of the swift script:
#!/usr/bin/env xcrun --sdk macosx swift
I am trying to upgrade my Cordova Ionic project ios platform from 3.0.1 to the newest 4.5.2 using xcode 9. I remove the ios platform and re-add it again under CLI 7.1.0. Then I restore all the .xcodeproject settings by copy the old .xcodeproject into the new ios platform and reset all the path necessary in the workspace. Luckily my project build successfully and runs fine in the debug mode.
However when I am trying to upgrade some out of date plugins in the new project, I found that I can only "add" plugin, which everything just goes fine. But when I am trying to remove any plugin (whether they have been added in the new workspace or not), the CLI always show red font message: Error: Could not find *-Info.plist file, or config.xml file.
This message will also show up if I tried to run ionic prepare ios command. Interestingly enough, if I use the .xcodeproject file cordova originally generated, then all the things will just work fine.
Any idea on what specific settings is wrong so that the CLI could only recognize the new .xcodeproject file but not the old .xcodeproject file?
To answer "why don't want to use the new .xcodeproject automatically generated". My project is pretty huge which contains 4 different targets and each of them have different project settings. First of all, CLI don't know that and will only generate one target and I have to duplicate it another 3 times. Secondly, it will be such a pain to restore each target settings one by one. And thirdly the new project doesn't contain any changes in the iOS native code I made such like in appDelegate class. Therefore I just want to find a trick way to make it through.
Cordova creates the files automatically, I believe copying a file generated from an old version and pasting a new one will break your project.
What happens if you remove the platform, add again but without reusing the .xcodeproject? The normal thing is that you got to work normally.
Another option would be to upgrade Cordova or a downgrade, using nvm you can have several versions of Nodejs and Cordova.
You didn't mentioned in your question how you are removing the ios platform , try to do them as follows:
cordova platform remove ios
cordova platform list here you can verify that ios platform deleted
cordova platform add ios --save
I don't know what version you are using but cordova 6.5.0 should solve the ios-build issues. you can install using like below:
sudo npm i -g cordova#6.5.0
It seems Apple changed this line:
swift build -X
This no longer works to create an Xcode project as described here
Doest anyone know the updated way to do this as I cannot find it online
Thanks
Now you should use the Swift Package Manager.
To create a project structure:
swift package init --type executable
or
swift package init --type library
To make a project compatible with Xcode:
swift package generate-xcodeproj
I'm trying to add new plugin (https://github.com/xu-li/cordova-plugin-wechat) to my phonegap project. but I get stuck on the installation number 1.
For number 1, they said Add wechat lib to your project. Don't forget to add the "URL Type". but I don't know where should I put library files to? which folder? because I know that every time I use cordova build ios command, it will generate new project files in platforms/ios. Should I put library files after generated?
Thank you.
Make sure you have install the required SDK. use command $ cordova platform add ios. Now add the generated files in the project folder. See if this works. Add Cordova command script file if required.
I am currently using Titanium 3.2.2 and Xcode 5.1.
I am following this documentation to create a module for my xcode project: https://wiki.appcelerator.org/display/guides/iOS+Module+Development+Guide
But this documentation is quite old and run command isn't excutable in this titanium.
Also how can I run titanium module using titanium application and not through command-line.
Try this link, much more up to date:
http://docs.appcelerator.com/titanium/3.0/#!/guide/iOS_Module_Development_Guide
Mostly you have to build the module and then drop the zip that is created into the correct folder, then add the Module in the Titanium tiapp.xml
See here for using legacy command line command
http://docs.appcelerator.com/titanium/3.0/#!/guide/Legacy_Command-Line_Interface-section-29004835_LegacyCommand-LineInterface-OSX
In short:
alias titanium.py="/Library/Application\ Support/Titanium/mobilesdk/osx/<VERSION>/titanium.py"
alias ios_builder="/Library/Application\ Support/Titanium/mobilesdk/osx/<VERSION>/iphone/builder.py"
or
alias titanium.py="$HOME/Library/Application\ Support/Titanium/mobilesdk/osx/<VERSION>/titanium.py"
alias ios_builder="$HOME/Library/Application\ Support/Titanium/mobilesdk/osx/<VERSION>/iphone/builder.py"
And please use titanium.py to create module project. Module projects created by titanium CLI cannot be run by titantium.py
I have created a ticket here: https://jira.appcelerator.org/browse/TC-4722
I think this may be a bug or incompatibility of titanium.py, but the project structure may be more appropriate than titanium.py (separate android and ios spaces in one module project), so for now, I just use ti to create a project structure, and copy assets, example and documentation to iphone directory and add .gitignore to ignore them.
Gulp #FTW
"gulpfile.js for Titanium Module Project"
https://github.com/yomybaby/gulpfile-timodule