Creating Cross-Platform C# Applications with Uno Platform
eBook - ePub

Creating Cross-Platform C# Applications with Uno Platform

Build apps with C# and XAML that run on Windows, macOS, iOS, Android, and WebAssembly

Matt Lacey, Marcel Alexander Wagner

Share book
  1. 258 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Creating Cross-Platform C# Applications with Uno Platform

Build apps with C# and XAML that run on Windows, macOS, iOS, Android, and WebAssembly

Matt Lacey, Marcel Alexander Wagner

Book details
Book preview
Table of contents
Citations

About This Book

Discover how to leverage the Uno Platform to write single-codebase, cross-platform mobile, desktop, and web applications using C# and XAML

Key Features

  • Enhance your Windows apps by running them on all operating systems and browsers
  • Use tools and APIs you already know to remain productive as you target new platforms
  • Create realistic apps for various lines of business (LOBs) and consumer scenarios

Book Description

Developers are increasingly being asked to build native applications that run on multiple operating systems and in the browser. In the past, this would have meant learning new technologies and making multiple copies of an application. But the Uno Platform allows you to use tools, languages, and APIs you already know from building Windows apps to develop apps that can also run on other platforms. This book will help you to create customer-facing as well as line-of-business apps that can be used on the device, browser, or operating system of your choice.

This practical guide enables developers to put their C# and XAML knowledge to work by writing cross-platform apps using the Uno Platform. Packed with tips and practical examples, this book will help you to build applications for common scenarios. You'll begin by learning about the Uno Platform through step-by-step explanations of essential concepts, before moving on to creating cross-platform apps for different lines of business. Throughout this book, you'll work with examples that will teach you how to combine your existing knowledge to manage common development environments and implement frequently needed functionality.

By the end of this Uno development book, you will have learned how to write your own cross-platform apps with the Uno Platform and use additional tools and libraries to speed up your app development process.

What you will learn

  • Understand how and why Uno could be the right fit for your needs
  • Set up your development environment for cross-platform app development with the Uno Platform and create your first Uno Platform app
  • Find out how to create apps for different business scenarios
  • Discover how to combine technologies and controls to accelerate development
  • Go beyond the basics and create 'world-ready' applications
  • Gain the confidence and experience to use Uno in your own projects

Who this book is for

This book is for developers who are familiar with app development for Windows and want to use their existing skills to build cross-platform apps. Basic knowledge of C# and XAML is required to get started with this book. Anyone with basic experience in app development using WPF, UWP, or WinUI will be able to learn how to create cross-platform applications with the Uno Platform.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Creating Cross-Platform C# Applications with Uno Platform an online PDF/ePUB?
Yes, you can access Creating Cross-Platform C# Applications with Uno Platform by Matt Lacey, Marcel Alexander Wagner in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in C#. We have over one million books available in our catalogue for you to explore.

Information

Year
2021
ISBN
9781801070867
Edition
1

Section 1: Getting to Know Uno Platform

This part of the book will provide you with all the information you need to know about Uno Platform and how to determine which of your projects it is appropriate for. It will then detail how to set up your development environment(s) for building apps with Uno Platform and walk you through creating your first app. It will then explore the basics of working with an app built with Uno Platform and show how you can use the tools and skills you're already familiar with. Additionally, it will show you how to do some of the most common tasks that developers need to do in most apps.
In this section, we include the following chapters:
  • Chapter 1, Introducing Uno Platform
  • Chapter 2, Writing Your First Uno Platform App

Chapter 1: Introducing Uno Platform

Uno Platform is a cross-platform, single-codebase solution for developing applications that run on various devices and operating systems. It does this while building on the rich heritage of Windows development APIs and tooling. This allows you to take the Windows app development skills you already have and use them to build apps for Android, iOS, macOS, WebAssembly, Linux, and others.
This book will be your guide to Uno Platform. It will show you how to use Uno Platform's functionality to build a variety of different applications that address real-world scenarios.
In this chapter, we'll cover the following topics:
  • Understanding what Uno Platform is
  • Using Uno Platform
  • Setting up your development environment
By the end of this chapter, you'll understand why you'll want to use Uno Platform to develop apps, and the types of applications it's best suited to help you build. You'll also be able to set up your environment so that you're ready to start building apps when reading subsequent chapters in this book.

Technical requirements

In this chapter, you will be guided through the process of setting up your development machine. To work through all the examples in the book, you will need a machine running any of the following:
  • Windows 10 (1809) or higher
  • macOS 10.15 (Catalina) or higher
If you only have access to one, you'll still be able to follow along with most of the book. The book will primarily assume you are working with a Windows machine. We will only show examples that use Mac when absolutely necessary.
There is no source code for this chapter. However, the code for the other chapters can be found at the following URL: https://github.com/PacktPublishing/Creating-Cross-Platform-C-Sharp-Applications-with-Uno-Platform.

Understanding what Uno Platform is

According to the website (https://platform.uno/), Uno Platform is "the first and only UI Platform for single-codebase applications for Windows, WebAssembly, iOS, macOS, Android and Linux."
That's a complex sentence so let's break down the key elements:
  • As a UI platform, it's a way of building applications with a User Interface (UI). This is in contrast to those platforms that are text-based and run from the command line (or equivalent), are embedded in hardware, or are interacted with in other ways, such as by voice.
  • Using a single code base means you only need to write code once to have it run on multiple devices and operating systems. Specifically, this means the same code can be compiled for each platform the app will run on. This is in contrast with tools that convert or transpile code into a different programming language before being compiled for another platform. It's also the only code base that's singular, not the output. Some comparable tools create a unique package that runs inside a host application on each OS, or create everything in HTML and JavaScript, and run inside an embedded browser. Uno Platform does neither of these. Instead, it produces native application packages for each platform.
  • Windows apps are based on the Universal Windows Platform (UWP) for Windows 10. Work is currently being done at Microsoft to make WinUI 3 the successor to UWP. Uno Platform has partnered with Microsoft to ensure that Uno Platform can easily transition from UWP once WinUI 3 is at a comparable operative level.
  • Windows support also includes the Windows Presentation Foundation (WPF), powered by SkiaSharp, for apps that need to run on older versions of Windows (7.1 or 8.1).
  • Applications that run in WebAssembly have all their code compiled to run inside a web browser. This means they can be accessed from any device with a compatible browser, without running code on the server.
  • By supporting iOS, the apps that are created can run on iPhones and iPads.
  • With support for macOS, the apps can run on a MacBook, iMac, or Mac Mini.
  • Support for Android applies to phones and tablets running the Android operating system.
  • Linux support applies to specific Linux PC equivalent distributions and is powered by SkiaSharp.
Uno Platform does all of the preceding by reusing the tooling, APIs, and XAML that Microsoft created for building UWP apps.
Another way to answer the "what is Uno Platform?" question is that it's a way to write code once and have it run everywhere. The exact definition of "everywhere" is imprecise, as it doesn't include every embedded system or microcontroller capable of running code. Still, many developers and businesses have long had the desire to write code once and run it easily on multiple platforms. Uno Platform makes this possible.
One of the early criticisms of Microsoft's UWP was that it was only universal on Windows. With Uno Platform, developers can now make their UWP apps genuinely universal.

A brief history of Uno Platform

With the varied number of cross-platform tools available today, it's easy to forget how limited the options were back in 2013. At that time, there were no general-purpose tools for easily building native apps that ran on multiple operating systems.
It was at that time that nventive (https://nventive.com/), a Canadian software design and development company, faced a challenge. They had lots of knowledge and experience in building applications for Windows and Microsoft tools, but their customers were also asking them to create applications for Android and iOS devices. Rather than retrain staff or duplicate effort by building multiple versions of the same software for the different platforms, they invented a way to compile the code they wrote for Windows Phone (and later UWP) apps and transfer it to other platforms.
By 2018, it was obvious this approach had been successful for them. They then did the two following things:
  1. They turned the tool they had created into an open source project, calling it Uno Platform.
  2. They added support for WebAssembly.
As an open source project, this allowed other developers tackling the same problem to work together. Uno Platform has since seen thousands of contributions from over 200 external contributors, and involvement has been expanded to support more platforms and add additional functionality for the initially supported platforms.
As an open source project...

Table of contents