How hard is it for a .NET programmer to learn Objective-C and Cocoa?

I am trying to create an application with two platforms for my own company. I'm trying to get started at night.

I have a .NET version, but haven’t finished the user interface part yet. I am thinking of buying some third-party controls.

If I buy these controls, they will obviously only work on my version of Windows. I am wondering if I should try to make UI in GTK # and use Mono with CocoaSharp or just build something in MS technology and teach myself the Mac side?

I'm just new to the Mac world, and I wonder how much of the learning curve might be there.

I thought maybe rewrite my core logic in Ruby or Python. This is why I could use the .NET version with .NET controls and presumably use the same code on a Mac.

This is a consumer-oriented educational app. Thus, it should not require much technical complexity for installation.

+4
source share
2 answers

If the non-visual part of the .NET application is quite large compared to the user interface, you can upgrade to the full version of .NET and adopt the following strategy with two steps:

  • The black part

    • Create an invisible part of .NET to be platform independent.
    • Platform-specific code for non-visual code must be isolated in small classes that provide the same interface so that they can be connected in accordance with the platform.
  • User interface

    • Use System.Windows.Forms (or your favorite toolkit) for Windows
    • Use the Cocoa Bridge (see this page for selection) for Mac OS X.

You can still benefit from learning Objective-C: since Cocoa bridges are usually heavily dependent on the Apple APIs, you will find great help in the Apple code sample (which is located in Objective-C).

On Windows, the application will work with the Microsoft.NET runtime, and on Mac OS X, the application will work with the Mono runtime.

DeepMeta application uses this strategy. As you can see, the user works very well on both platforms.

+3
source

Avoid using cross-platform interface tools; the result will never be as good as the native implementation, which is especially bad for OS X, where most customers expect a certain level of Polish in their applications. Implementing the core logic in a platform-independent language such as C ++ and supporting a different code base for the interface on each platform can be a good solution, especially if you have a very complex model.

In any case, you should not have too much difficulty learning Cocoa if you are a good .NET programmer; I did the opposite a few years ago and did not experience any particular problems. Objective-C is more C-oriented than C #, but if you know the basics of pointers and you will be fine. Cocoa and .NET definitely have their differences in certain areas, but they are both high-level frameworks that you shouldn't have too many problems with. Get a good book (Hillegass is the author) and go through it so that you understand how the two APIs use different design templates in certain areas and do not try to deal with the framework if it is different from what you use to.

In my experience, this will ultimately make you a better programmer, expanding your knowledge, even if you no longer write Cocoa applications.

+3
source

Source: https://habr.com/ru/post/1311006/


All Articles