The first anniversary of GitHub's WINOBJC project recently released a preview version, and finally waited until this day. The WINOBJC project is Microsoft's announced Project Islandwood program at the build 2015 conference, dedicated to quickly porting iOS apps to uwp apps. Needless to say, let's take a look at how the WINOBJC project is actually used.
Before you begin
Start the transformation of iOS items now we need to deploy the WINOBJC tool, the tool chain is as follows:
- A Windows PC,2015 Community Edition with Visual Studio installed can be downloaded directly: Free download
- Install the WINOBJC Bridge tool for the iOS app and download it directly: Github
- Prepare some iOS projects that you can use, and there are many open source projects on GitHub
Note: Make sure you have installed the Windows SDK, or you will not be able to build using UWP projects.
In addition, you can directly use the evaluation version of Windows 10 development environment VM that Microsoft has configured. The virtual machine has been configured with the latest development environment to meet the needs, so you quickly use the latest tools on your Mac or PC to evaluate. The following are for different virtual machines:
- VMware Https://aka.ms/windev_vm_vmware
- Hyper-V https://aka.ms/windev_VM_hyperv
- VirtualBox Https://aka.ms/windev_VM_virtualbox
- Parallels Https://aka.ms/windev_VM_parallels
How to use
After extracting the downloaded Winobjc.zip file into a local file, we have an iOS bridge tool that we can use directly. Here I am using the example project of the famous iOS HUD framework Mbprogresshud to do the test, as follows: Https://github.com/jdg/MBProgressHUD
We mainly use the Vsimporter tool, using the following steps:
- Open the command line and navigate to the directory where the iOS project resides. CD C:\Users\changwei\Desktop\iOS\MBProgressHUD-master\Demo
- Run the Vsimporter tool from the command line. C:\Users\changwei\Desktop\winobjc\bin\vsimporter.exe
- Vsiimporter automatically removes test projects and tvOS projects that are not currently supported, generating a UWP project with the following results:
4. You can see that the SLN solution file has been generated and opens directly
5.Winobjc Folder Bin directory has a objective-c language highlighting plugin objc-syntax-highlighting.vsix, we do not forget to install OH. The current solution sln file, when opened, is a standard UWP project that runs directly ctrl+f5 the project.
The first build will take a long time, but the most painful is the compilation failed, Goodbye (sure enough or big pits).
Then I tried a lot of iOS projects, including some sample projects that were downloaded from the Apple Developer Center. most of them compile errors, and many of the UI interfaces and features that are run by a few can be incorrect, and are currently not functioning properly except for the official WINOJC sample project.
Let's take a look at what the official running example project actually looks like, as follows:
List View UITableView
Collection View Uicollectionview
Picture View Uiimageview
I tried to write a objective-c code into the project, adding an orange-yellow view to the current window, as follows:
UIView *testview = [[UIView alloc] Initwithframe:cgrectmake (0,0,200,200)];testview.backgroundcolor = [Uicolor Orangecolor]; [Self.view Addsubview:testview];
After the compilation runs, does not have the problem to execute, the function is also normal operation, as follows:
Summarize
The WINOBJC project looks beautiful, but it is still an unbearable pie. For a year, it is more than the beginning of progress, rewrite support for most of the iOS base library, Uikit and other basic framework completion is very high, AutoLayout, storyboard and xib are supported, but there is a long way to go. At present, we can still taste fresh, in fact, in my opinion, instead of rewriting the iOS framework, it is better to develop a set of Windows development Framework support OBJECTIVE-C, think better than now, not to be led by iOS, the problem continues.
iOS project builds a universal Windows app