Building Cross-Platform GUI Applications with Fyne

Building Cross-Platform GUI Applications with Fyne

The development of graphical user interfaces has a long history, resulting in a complicated landscape today. There are many different ways to build applications, each with their own benefits and drawbacks. In this modern world, with so many different devices in our everyday lives, it can seem impossible to reach an entire audience without building many different apps or GUIs. The technologies required are often platform-specific, and many of the technologies that exist have evolved across decades, leaving a legacy that can slow down new developers and experienced teams alike.

In the same way that the Go programming language was designed to make software development easier across all operating systems, the Fyne toolkit aims to empower graphical app creation in a platform-agnostic manner. This definitive guide to building applications with the Fyne toolkit aims to assist software engineers of any experience level in learning the APIs and processes involved. From your first line of Fyne code through to deploying an application to global marketplaces, the samples and screenshots will guide you on each step of the journey.

Who this book is for

This book is written both for Go developers who are interested in building native graphical applications and for those with platform-specific GUI experience looking for a cross-platform solution. Some knowledge of building Go applications is assumed, but not essential. The book opens with a history of the GUI for anyone who is not familiar, and then introduces the Fyne project and its vision and ambition to solve many of the challenges faced by developers of native applications across desktop and mobile devices.

With the help of code snippets and worked examples, developers of every level should be successful in building their first Fyne apps. As well as running these apps on your computers and mobile devices, you will also be taken through the preparation and upload process to deploy to app stores and marketplaces.

What this book covers

Chapter 1, A Brief History of GUI Toolkits and Cross-Platform Development, contains a short reminder of the history behind graphical applications and how the toolkits used to develop them have evolved over time. We look at the different approaches to cross-platform development and why it is important. By the end of this chapter, you will be familiar with the benefits and challenges of GUI toolkits in approaching cross-platform app development.

Chapter 2, The Future According to Fyne, introduces the Fyne toolkit and its approach to supporting all operating systems, with a Material Design-inspired user interface look and feel. In this chapter, we will explore the vision of the Fyne toolkit and how it builds on the Go language to create an easy-to-use, cross-platform GUI toolkit. After reading this chapter, you will see how Fyne aims to solve the challenges outlined in the first chapter of the book and how it aims to shape app development in the future.

Chapter 3, Window, Canvas, and Drawing, introduces the main APIs behind the rendering layer of the Fyne toolkit. We will see how to draw objects and how to combine them using containers to create more complex output. This chapter also covers the APIs required to load an application and manage its windows. We complete this chapter with an example that uses graphic elements and animations to create a simple cross-platform game.

Chapter 4, Layout and File Handling, expands on the manual placement of elements in the previous chapter. We will examine the standard layouts that are provided and how they are combined to form complex user interface structures, as well as how to build our own. Also covered is the filesystem abstraction, which provides standard file access for traditional filesystems and the more complex mobile data sharing methodologies. We will apply all this knowledge to create an image browsing app at the end of the chapter.

Chapter 5, Widget Library and Themes, introduces the largest package within the Fyne toolkit – its widget library. In this chapter, we will explore the main widgets available and how to use them in constructing an application GUI. We will see how their standardized look and feel can be influenced through theme selection and how user preferences, such as light or dark modes, are rendered using the built-in theme. This chapter is completed with a step-by-step creation of a task management app using many of the widgets explored earlier.

Chapter 6, Data Binding and Storage, explores APIs that help to efficiently manage data and storage within a Fyne app. We will see how the widgets seen in the previous chapter can be bound to data elements and thereby avoid much of the code that was necessary to set up and manage their contents. Also demonstrated is how applications can manage user preferences and how they can connect through data binding directly to widget values. The concepts in this chapter are applied through the creation of a health app that helps to track your water consumption.

Chapter 7, Building Custom Widgets and Themes, demonstrates how applications with bespoke requirements can build on the solid foundations explored in the previous chapters. We will examine the various ways in which developers can customize and extend existing widgets, or build completely bespoke components. We will also see how custom themes can be loaded to give apps more brand identity or add custom fonts and icons. Using these features, we will build an instant messenger user interface that displays a distinct style and custom widgets.

Chapter 8, Project Structure and Best Practices, builds on the best practices that are well documented for the Go language. We will see how to organize projects to keep the code clean and facilitate easier maintenance as they grow. We will also explore how unit testing and test-driven development are possible and encouraged when building GUIs with Fyne. Additionally, on the rare occasion where platform-specific code may be required, we see how an app can adjust its behavior for different target platforms.

Chapter 9, Bundling Resources and Preparing for Release, explains how packaging up a graphical application is more complex than a simple binary that would be accessed from the command line. In this chapter, we see what metadata is required to allow a Fyne app to blend in with other desktop and mobile applications. We also step through the process for bundling apps so that they can be shared and installed, as end users would expect of a platform native application.

Chapter 10, Distribution – App Stores and Beyond, confronts the final challenge of cross-platform application development – distribution. We will see how applications are prepared for public release and packaged with extra data and code signing required by many app stores. We wrap up the book by stepping through the upload process for Apple, Google, and Microsoft stores, along with distribution to Unix systems.

Appendix A, Developer Tool Installation, contains platform-specific steps for managing software required by other chapters. This chapter will assist new developers to install the compilers and tools required to build the examples in this book.

Appendix B, Installation of Mobile Build Tools, provides documentation for setting up the additional tools that will be required to build Fyne apps for mobile devices. Android and iOS builds can be created locally after following these steps. Alternatively developers could choose to use fyne-cross, covered in Appendix C, Cross-Compiling.

Appendix C, Cross-Compiling, outlines the platform specific installation and configuration that is required to set up the building of different operating systems. Following these steps, developers will be able to compile their Fyne apps for different platforms using just one computer. It also shows how to set up the Fyne cross compiling solution fyne-cross for developers that don’t want to manage the tools in detail themselves.


  • 关于本书的内容介绍、目录、详情等请在 AmazonGoolge Books 等售书网站搜索查看,本站仅展示封面作为参考。
  • 如无特殊说明,本站提供的所有pdf均为文字版(aka True PDF or Digitally Created PDF)。
  • 本站已经列出的所有图书均可以找到。
  • 收到PDF链接之后建议尽快下载或者保存到自己的百度网盘,防止链接过期失效。


扫描下方二维码添加微信号 bookyage 回复本书编号 195897 即可,我们会尽快(一般24小时之内)将本书PDF文件以百度网盘链接的形式发送给您。