Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Building Cross-Platform GUI Applications with Fyne

You're reading from  Building Cross-Platform GUI Applications with Fyne

Product type Book
Published in Jan 2021
Publisher Packt
ISBN-13 9781800563162
Pages 318 pages
Edition 1st Edition
Languages
Author (1):
Andrew Williams Andrew Williams
Profile icon Andrew Williams

Table of Contents (18) Chapters

Preface 1. Section 1: Why Fyne? The Reason for Being and a Vision of the Future
2. Chapter 1: A Brief History of GUI Toolkits and Cross-Platform Development 3. Chapter 2: The Future According to Fyne 4. Section 2: Components of a Fyne App
5. Chapter 3: Window, Canvas, and Drawing 6. Chapter 4: Layout and File Handling 7. Chapter 5: Widget Library and Themes 8. Chapter 6: Data Binding and Storage 9. Chapter 7: Building Custom Widgets and Themes 10. Section 3: Packaging and Distribution
11. Chapter 8: Project Structure and Best Practices 12. Chapter 9: Bundling Resources and Preparing for Release 13. Chapter 10: Distribution – App Stores and Beyond 14. Other Books You May Enjoy Appendix A: Developer Tool Installation 1. Appendix B: Installing Mobile Build Tools 2. Appendix C: Cross-Compiling

Chapter 2: The Future According to Fyne

The Fyne toolkit design is based on the premise that the best way to resolve many of the challenges raised in Chapter 1, A Brief History of GUI Toolkits and Cross-Platform Development, is to take a fresh approach to GUI toolkit design. It aims to combine the benefits of a modern programming language, the Material Design look, and a simple API.

In this chapter, we explore the background and ambition of the Fyne project, including the following:

  • The vision for Fyne and its team
  • How does a modern programming language enable a fresh approach?
  • How does it address the complexities of cross-platform, native app development?

Technical requirements

In this chapter, we will be using examples of Go code, so you will need to install the Go compiler – refer to the instructions at https://golang.org/doc/install. We will also explore bridging to C APIs, so you will need to install a C compiler as well. The installation of C varies from system to system. You can find details in Appendix A, Developer Tool Installation.

The full source code for this chapter can be found at https://github.com/PacktPublishing/Building-Cross-Platform-GUI-Applications-with-Fyne/tree/master/Chapter02.

Starting with a clean slate

Through the history of GUI development, we see that the majority of the most popular toolkits are based on C or C++ language code. These projects have a substantial history, large communities, and innumerable hours of development to make them what they are today. Despite being the yardstick against which all other toolkits are measured, they have drawbacks, mostly due to the legacy of the old design decisions they are built on. In this section, we reflect on why starting from scratch creates a better experience for building cross-platform apps.

Designing for modern devices

The types of devices we use today are both vastly different and much more varied compared with the 1980s and 1990s, when the most common toolkits were being designed and built. Today, a graphical application could be running on a desktop computer, laptop or netbook, a mobile device or tablet, smart phone or watch form factor, or even a set-top box or a smart TV. These device categories...

How Go is a great fit for this challenge

In the previous section, we saw that there are many reasons why graphical toolkits are rooted in dated foundations and that even the languages they are built with could be limiting their chances of adapting. A number of manufacturers are recognizing this problem and reaching to new languages to find solutions or even avoid the challenges of the past completely. Apple is moving all development to the Swift language, although Apple-supported software is designed to run on their devices only. Other companies, such as Facebook, are finding ways to adapt more modern web-based tools to create native apps for phones and desktop.

Neither the approach of a platform-specific technology nor languages derived from the interpreted internet technologies are going to be able to truly create a delightful development experience. We are looking for a development platform that results in performant and robust, cross-platform applications—the panacea...

Looking good with Material Design

A key part of any GUI toolkit that can impact the developer’s selection and also the user appeal of the applications built is the overall design language. This choice of aesthetic can be seen in the colors, fonts, layouts, and even icon design. Some of these choices are obvious and others more subtle, but, when combined, result in a recognizable application look and feel.

New cross-platform toolkits commonly create their own design, such as Java’s Swing or the GTK+ and Qt toolkits. These are often designed to look contemporary with the software of the time—you can recognize a 1990s desktop application design in those toolkits. In the current landscape, usability and design principles of mobile apps are being adapted and deployed to other areas, bringing a new age of software design to traditional applications. Because of its work in this space, the Material Design project makes a good match for application design aiming at universal...

Designing APIs for simplicity and maintainability

A delightful user experience is an important ambition for any application toolkit, but Fyne aims to make the experience of development a pleasure as well. To do this, the API must be planned carefully to be simple and easy to learn, but also extensible to support more complex applications. The project’s modular approach aims to support this while also being testable every step of the way.

Semantic API

An API (or Application Programming Interface) is typically defined as a set of functions and procedures that controls access to features and data. At a high level, however, the Fyne toolkit aims to deliver a semantic API, a set of functions that defines intent rather than features or functionality. By taking this approach, the toolkit is able to separate meaning from presentation.

For example, we can consider a simple button—when there are many on a screen, you may wish for one to stand out against the other as more...

A vision of the future

The Fyne project was created in response to growing criticism of the complexity in existing graphical toolkits and application APIs and their inability to adapt to modern devices and best practices. It was designed with the aim of being easy to use, and the Go language was chosen for its powerful simplicity.

The vision statement on the Fyne project wiki (https://github.com/fyne-io/fyne/wiki/Vision) states the following:

Fyne’s APIs aim to be the best for developing beautiful, usable, and lightweight applications for desktop and beyond.

With more device types and platform-specific toolkits than we have seen in recent times, it is more difficult, and more expensive than ever, to deliver a great native app experience across all platforms. The Fyne toolkit is positioned as a solution to these challenges, while bringing the design and user experience learning from modern mobile apps to all devices.

Beautiful apps

Fyne aims to support the building...

Summary

In this chapter, we have seen how designing a new graphical toolkit could overcome many of the challenges still faced by existing approaches. We explored the background and vision for Fyne, how it aims to solve these difficulties, and how it supports creating beautiful and performant apps across all popular desktop and mobile devices. We introduced Material Design and saw how it brings modern usability principles and design learnings to desktop and beyond. By using the fyne build tools, we saw that an app can be built and distributed for any devices or app stores without any platform-specific code.

In the next chapter, we will explore the fundamentals of a Fyne application and see how its drawing capabilities allow us to build a simple game.

Further reading

To learn more about some of the topics introduced in this chapter, you can visit the following websites:

lock icon The rest of the chapter is locked
You have been reading a chapter from
Building Cross-Platform GUI Applications with Fyne
Published in: Jan 2021 Publisher: Packt ISBN-13: 9781800563162
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}