Giter Site home page Giter Site logo

microsoft / winobjc Goto Github PK

View Code? Open in Web Editor NEW
6.2K 458.0 815.0 377.53 MB

Objective-C for Windows

License: MIT License

Objective-C++ 28.17% C++ 12.76% C 33.55% Objective-C 24.24% C# 0.86% Python 0.02% PowerShell 0.13% Yacc 0.02% Lex 0.01% Assembly 0.03% Makefile 0.01% Batchfile 0.01% Shell 0.01% Mathematica 0.19%

winobjc's Introduction

Welcome to the Windows Bridge for iOS Project

The Windows Bridge for iOS (also referred to as WinObjC) is a Microsoft open-source project that provides an Objective-C development environment for Visual Studio and support for iOS APIs. The bridge allows you to create Universal Windows Platform (UWP) apps that will run on many Windows devices by re-using your Objective-C code and iOS APIs alongside Windows 10 features like Cortana and Windows Notifications.

license

Build and Release Status

Stable (master) Pre-release (develop)
Build VSTS VSTS
GitHub Release Github Release -
winobjc-tools Tools Tools
WinObjC.Language Language Language
WinObjC.Frameworks Frameworks Frameworks

Download and Installation

To use the bridge you'll need:

  • Windows 10, build 10586 or higher. Validate your version number here.

  • Visual Studio 2017 with Windows developer tools. Visual Studio 2017 Community is available for free here.

    Ensure the following individual components are selected during installation. Selecting the Universal Windows Platform development workflow should give most of the below

    NOTE: Please also install the Mobile development with .NET workflow option (Xamarin Tools) due to a bug in Nugetizer (See Issue 5026)

    (Click to Expand)

    • Visual Studio Core Editor
    • Nuget Package Manager
    • C# and Visual Basic Roslyn compilers
    • Static analysis tools
    • Windows 10 SDK (10.0.14393.0)
    • Visual Studio C++ core features
    • VC++ 2017 v141 toolset (x86, x64)
    • Visual C++ compilers and libraries for ARM
    • Visual C++ runtime for UWP
    • Windows 10 SDK (10.0.10240.0)
    • Windows 10 SDK (10.0.10586.0)
    • MSBuild
    • Windows Universal CRT SDK
    • Standard Library Modules
    • VC++ 2015.3 v140 toolset (x86,x64)
    • Windows Universal C Runtime

To get started with an existing Xcode Project, you will also need:

  • Chocolatey, a package manager for windows. See how to install the latest version here
  • winobjc-tools, the command line tools for WinObjC. Run the below command from powershell (Admin) to get the latest version:
choco upgrade winobjc-tools

(more information about this command and its options can be found here. If you want to use develop packages add --pre to the command.)

Getting Started With the Bridge

Importing your Xcode Project

When using the bridge, the first thing you'll want to do is generate a Visual Studio solution from your Xcode project:

  1. Open Windows PowerShell (type powershell in the Start Menu to find it) and navigate to your Xcode project directory using the cd command. Note: use the directory containing your .workspace or .xcodeproj folder.
  C:\> cd C:\MyProject
  1. Run the vsimporter tool. This will generate the Visual Studio Solution:
  C:\MyProject> vsimporter.exe
  1. Open the generated Visual Studio solution with the command:
  C:\MyProject> MyProject.sln

For more detailed step by step instructions on how to import a project, see the Quick Start Tutorial page of the wiki. For vsimporter options and known issues, check the Using vsimporter wiki page.

Building & Running the Samples

A great way to learn more about the bridge and its features is building and running the samples of the SDK, which contain many code examples. We recommend starting with the WOCCatalog sample app, which demonstrates an assortment of iOS and XAML UI controls:

  1. Clone the repo.
  2. Navigate to the samples/WOCCatalog directory of the bridge SDK
  3. Double-click on the WOCCatalog-WinStore10.sln solution to open it in Visual Studio
  4. In Visual Studio, right-click on the WOCCatalog (Universal Windows) project
  5. Select Set as StartUp project
  6. Use Ctrl-F5 to build and run the app

For more detailed step by step instructions, see the Quick Start Tutorial page of the wiki.

Resources & Documentation

The following resources will help you get started. For more information, check out:

  1. Wiki, for documentation and tutorials
  2. Development Roadmap, detailing our highest priorities
  3. Website on Windows Dev Center, for evaluation virtual machines
  4. Quick Start Challenge, for a quick hands-on introduction to the bridge
  5. FAQ, with common questions and issues
  6. The iOS Bridge Samples Repo, for sample apps and code using the bridge

Contributing

There are many ways to contribute to the Windows Bridge for iOS:

See our contribution guidance in the wiki for more details on how to contribute to the project.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Advanced Installation for Contributors and Ninjas

Additional Visual Studio Components Needed for Contributors:

  1. C# and Visual Basic
  2. Visual Studio SDK
  3. .NET Framework 4.6 targeting pack
  4. C++ Profiling Tools

If you want to build the bridge from source instead, you'll also need to install Git LFS before cloning the repo. For more detailed instructions, see the Building From Source wiki page.

If you're having trouble downloading & installing the bridge, see the Known Issues section below and check our FAQ.

Privacy

See Microsoft's privacy statement for more information.

Roadmap

For details on our planned features and future direction sort the list of issues by milestone and refer to our roadmap.

Known Issues

winobjc's People

Contributors

aballway avatar amagams avatar andschub-ms avatar ashvarma avatar asimonov-msft avatar bbowman avatar bdrlamb-ms avatar brianker avatar bviglietta avatar davelamb avatar dhowett avatar ehren avatar jaredhms avatar jmsaunders-ms avatar jofre-ms avatar kellymor avatar memontic-ms avatar mnithish avatar ms-jihua avatar msft-jeyaram avatar msftfox avatar mukhole avatar oliversa-msft avatar oren-msft avatar pradipd avatar ramu-msft avatar s5msft avatar triplef avatar weswmsft avatar yiyang-msft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

winobjc's Issues

Address Syntax Highlighting in the Readme

I noticed there is a syntax highlighting plugin, but as someone who's more familiar with Xcode, I haven't been able to get it working. Online I read double clicking it should work, but I'm getting no response in VS2015 when I do that.

Bridged Casting Not Supported

When you have code such as the following, should the __bridge cast be supported?

CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"path"];
animation.duration = _progressAnimationDuration;
animation.timingFunction = [CAMediaTimingFunction functionWithName:_progressAnimationTimingFunction];
animation.fromValue = (__bridge id) oldPath;
animation.toValue = (__bridge id) path;
[_progressShape addAnimation:animation forKey:@"animatePath"];

Support xcworkspace generated by CocoaPods

While importing my project, which is managed by CocoaPods, the vsimporter failed to find targets in Pods project and some build phases in targets generated by CocoaPods are unsupported and ignored as well. Considering that CocoaPods is quite popular in the community, it would be great if a specific support for CocoaPods is provided in WinObjC.

How are libraries handled by vsimporter?

When I run vsimporter on a project with libraries, the resulting solution has a single Windows Store app, the dependent libraries in all one solution. That's great.
But I'm a little confused about the conversion process. The libraries are set-up as .lib outputs, but the main executable has a reference to them as assemblies.
The problem is that the solution won't compile the dependent libraries. I'm seeing errors about missing .tlh files - which it seems to expect to see for each #import.

Are libraries supported at the moment?

UIBezierPath Not Found

This class should be ported as it's very useful for iOS controls that use CALayers or CoreGraphics.

Building and using Windows Runtime components in Objective-C

I would like to see an ability to build Windows Runtime components that can be used from any supported language using the existing Objective-C code. This would make possible for Objective-C devs spending as little effort building Windows Runtime components using the existing code as possible.

For now, there is only info on how to use Windows Runtime APIs from Objective-C code, but there is nothing I can find regarding how Objective-C code can be used from C++/CX. Building Windows Runtime components could be achieved in two ways: building the ability to create WinRT components into Objective-C compiler and linker, and/or enabling interoperability between C++/CX and Obj-C code so WinRT components could be built using C++/CX that imports Obj-C functions.

Also consider the ability to use custom WinRT components written in any WinRT language (C++, C#, etc.) from Objective-C code.

'sys/types.h' file not found

I use winobjc prebuilt tool to convert to winstore10 project successfully, but compile the project have a error : CoreFoundation/CoreFoundation.h(11,10): fatal error : 'sys/types.h' file not found

Restore original licenses

Many many headers and implementation in Frameworks/Foundation are from my Cocotron project and have had the original license completely removed and replaced.

The ONE SINGLE requirement of the Cocotron MIT license is that the license text, including copyright holders, remains in the source. THAT'S IT, can you please manage to do that.

Please restore all original licensing w/ copyright holders in all derivative works.

Thanks!

GLKit not supported.

GLKit is not supported. GLKit was released with iOS 5. Many iOS application are dependent on the library.

Enable the use of existing iOS libraries

This is more like a suggestion than an issue.

I would like to see an ability to build Windows Runtime components that can be used from any supported language and that can use existing iOS libraries.

I'm a C# developer, and the company I work for uses Flurry Analytics in mobile apps. I'm building mobile apps for Windows and Windows Phone, and recently I learned that Flurry doesn't support Windows Runtime SDK anymore. This issue could be easily solved with Windows iOS Bridge by just using Flurry's iOS SDK and wrapping it up in a Windows Runtime component.

I believe there are many other examples of such an application for iOS Bridge.

Windows Runtime components are discussed in issue #20

OSX support

iOS developer already made some investment in hardware/software would be nice if have a native OSX support.

Suggestion - publish a roadmap

It would be great if you could publish a roadmap, what's a priority for the team and what areas you're looking for the community to contribute.
The model used by the TypeScript team (and others) seems to work well, where GH issues are tagged as "accepting PRs" and a roadmap is published and kept to the date.

Xib support

I have created a very basic Xcode project with a single Xib file containing a UIView with several text fields and a button. I'm not using Auto Layout or Storyboards.
In my AppDelegate I'm instantiating the corresponding View Controller and add it to my Navigation Controller.

This works fine on iOS but the only thing I get when importing the project into Visual Studio is the Navigation Controller's title - everything else is black when running on Windows 10.
I have verified that my View Controller at least gets loaded by putting a breakpoint in the viewDidLoad method which indeed gets hit.

The WOCCatalog sample works fine but I have noticed there are no Xibs included in this project.

So my question is, are Xibs (even with limitations, like no Auto Layout) supported at this stage?

Pods Support?

I'm getting a ton of errors when trying to run my Objective-C projects. In particular, I'm getting a lot of errors with my third-party pods. So, I was wondering if pods are supported? I'm also not sure if I'm setting the pods up correctly. Should I go about installing Cocoapods and doing a pod update? I just copied the pod folder with source along with the application source and ran the vsimporter tool.

vsimporter crashes

When I run vsimporter with -loglevel debug all I get before the crash is: [W] Ignoring unsupported PBXHeadersBuildPhase in "Plugins" target. I'm running version 1.0 (2627d23).

Unfortunately I can't share my Xcode project. Is there a way to get more information to diagnose?

Thanks!

Swift Support

Is it possible to support Swift also in a similar way?

Off-by-one error and missing range checks in UIButton

The _states array has a size of 16 (UIButton.mm:141 & 288 _states = (buttonState *) EbrCalloc(16, sizeof(buttonState));).

However, in setImage:forState the range check is wrong:

    -(void) setImage:(UIImage*)image forState:(UIControlState)state {
        if ( state > 16 ) {
            EbrDebugLog("setImageState: bad mask %x\n", state);
            return;
        }
        assert(state < 16);
        _states[state].image = image;
        [self setNeedsDisplay];
        [self setNeedsLayout];
        setImageProperties(self);
    }

The check should be if ( state >= 16 ) to avoid running into the assertion. The assertion is then unnecessary.

The other methods dealing with states passed by the user (lines 326 โ€“ 387) don't have any range checks, only assertions. These methods should all handle those cases consistently: either all should only do the assertions, or all should do the graceful checks and simply return.

Providing a macro to do these checks might be a good idea.

Pods Support?

I'm getting a ton of errors when trying to run my Objective-C projects. In particular, I'm getting a lot of errors with my third-party pods. So, I was wondering if pods are supported? I'm also not sure if I'm setting the pods up correctly. Should I go about installing Cocoapods and doing a pod update? I just copied the pod folder with source along with the application source and ran the vsimporter tool.

mDNS support

I'm curious about the use of mDNS, as many iOS apps use either the dns_sd.h header directly, or some other API on top of it (usually Apple's).

Apple does have a Bonjour SDK for Windows already, and the source code is available under the Apache 2.0 license.

arc4random not cryptographically secure

People rely on arc4random being a cryptographically secure source of random numbers.

The implementation in CFMisc.mm is just calling rand() a few times which is pretty terrible.

It should instead use a real cryptographic PRNG algorithm and be seeded from some kind of reliable source of random data. Either implement it properly or at least call an equivalent windows API for some secure random numbers.

Core Data Support?

I was wondering if Core Data is supported? I don't see the Core Data Framework in the WinObjC project files, but I do see a generated Window's sqllite db. How is Core Data being handled?

Use libobj, libdispatch, CF?

I'm curious why the team didn't adopt any of the existing code from Apple's open source libraries? Specifically things like libdispatch, libobjc, and CoreFoundation are available and have Windows #ifdefs in them since that's how iTunes & co run on Windows. Then you'd have 100% compatibility at those layers.

Factors wrong in CGGraphicBufferImage.mm

I was just reading some of the code and came across this bug.

In WinObjC-master/Frameworks/CoreGraphics/CGGraphicBufferImage.mm

https://github.com/Microsoft/WinObjC/blob/master/Frameworks/CoreGraphics/CGGraphicBufferImage.mm

Line 262:

This code:

    case _Color565: {
        WORD srcPixel = *(((WORD *) LockImageData()) + (Height() - y - 1) * (BytesPerRow() >> 1) + x);
        ReleaseImageData();

        r = ((float) (srcPixel & 0x1F)) / 32.0f;
        g = (float) ((srcPixel >> 5) & 0x3F) / 64.0f;
        b = (float) ((srcPixel >> 11) & 0x1F) / 32.0f;
        a = 1.0f;
        }
        break;

Should probably look like this:

    case _Color565: {
        WORD srcPixel = *(((WORD *) LockImageData()) + (Height() - y - 1) * (BytesPerRow() >> 1) + x);
        ReleaseImageData();

        r = ((float) (srcPixel & 0x1F)) / 31.0f;
        g = (float) ((srcPixel >> 5) & 0x3F) / 63.0f;
        b = (float) ((srcPixel >> 11) & 0x1F) / 31.0f;
        a = 1.0f;
        }
        break;

0x1F == 31.0

and

0x3F == 63.0

Setting app rootViewController bug

in AppDelegate.m file, I write those code,

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    UITableViewController *vc=[[UITableViewController alloc] init];
    self.window.rootViewController=[[UINavigationController alloc] initWithRootViewController:vc];
    return YES;
    }

After built it, i find it broken

2015-08-07 5 51 13

using same code in Xcode, it will work normally

2015-08-07 5 50 00

Autolayout support

Wanted to go ahead and get an issue created for this. Our app is pretty much 100% auto layout based, there's about zero chance we could port any UI code without this support.

The glMaterialf and glMaterialfv seems to be not supported in OpenGL ES

While trying to compile the Apple iOS sample GLGravity the OpenGL functions glMaterialf and glMaterialfv seems to be not supported.

GLGravityView_D4D7D164.obj : error LNK2019: unresolved external symbol _glMaterialfv referenced in function __i_GLGravityView__setupView
GLGravityView_D4D7D164.obj : error LNK2019: unresolved external symbol _glMaterialf referenced in function __i_GLGravityView__setupView

/CLI:* options

Add options to generate mixed, pure and / or safe CIL/CLI/CLR/.net code.

Install Missing features does nothing

I get a box that says I need to install Universal Windows Platform Tools to load the sample project, after clicking "install" nothing happens....

any ideas?

Objective-C syntax highlighting doesn't work

I installed VS 2015 Community Edition along with the mentioned tools. After that, I downloaded WinObjc and opened the WOCCatalog solution file. The project doesn't have any syntax highlighting. I
ran the tool objc-syntax-highlighting present inside /bin folder. The tool failed to install with error "This extension is not installable on any currently installed products."

capture

09-08-2015 12.42.41 PM - Microsoft VSIX Installer
09-08-2015 12.42.41 PM - -------------------------------------------
09-08-2015 12.42.41 PM - Initializing Install...
09-08-2015 12.42.41 PM - Extension Details...
09-08-2015 12.42.41 PM - Identifier : VSIX..9c35fff1-f084-44c1-a38e-68c707163aa2
09-08-2015 12.42.41 PM - Name : Objective-C Language Service
09-08-2015 12.42.41 PM - Author : Microsoft
09-08-2015 12.42.41 PM - Version : 1.0
09-08-2015 12.42.41 PM - Description : This package contains Objective-C language service components such as syntax higlighting etc
09-08-2015 12.42.41 PM - Locale : en-US
09-08-2015 12.42.41 PM - MoreInfoURL :
09-08-2015 12.42.41 PM - InstalledByMSI : False
09-08-2015 12.42.41 PM - SupportedFrameworkVersionRange : [4.5,)
09-08-2015 12.42.41 PM -
09-08-2015 12.42.41 PM - Supported Products :
09-08-2015 12.42.41 PM - Microsoft.VisualStudio.Pro
09-08-2015 12.42.41 PM - Version : [12.0]
09-08-2015 12.42.41 PM -
09-08-2015 12.42.41 PM - References :
09-08-2015 12.42.41 PM -
09-08-2015 12.42.41 PM - Searching for applicable products...
09-08-2015 12.42.41 PM - Found installed product - Microsoft Visual Studio Community 2015
09-08-2015 12.42.41 PM - Found installed product - Microsoft Visual Studio 2015 Shell (Integrated)
09-08-2015 12.42.41 PM - Found installed product - Global Location
09-08-2015 12.42.41 PM - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
at VSIXInstaller.App.InitializeInstall(Boolean isRepairSupported)
at VSIXInstaller.App.InitializeInstall()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

Missing OpenGLES?

I'm seeing errors that OpenGLES.lib is missing. I can see libGLESv2.lib as a prebuild dependency. Am I missing a pre-req?

Define a code style to follow for all sources

Right now it seems there are no conventions for code style. Different sources are formatted differently, it order to have a coherent look for all sources it' proposed to choose of the options:

  1. LLVM
  2. Google
  3. Chromium
  4. [Mozilla](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style
  5. WebKit

and follow them by using git pre-commit hooks driven by clang-format. The styles from the list are supported out of the box.

I have an experience with setting this infrastructure up, so I am ready to proceed with re-formatting and adding the mentioned hooks. What I need is the decision which code style is to use.

Not supporting kNilOptions

The compiler does not support kNilOptions. Aside this is not widely used it would be nice if it would not be necessary to replace this with nil :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.