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.