Integrating Buy Me A Coffee Into Your iOS Apps With SwiftUI

Aditya Saravana
2 min readAug 22, 2021

--

With Buy Me A Coffee, you can “accept support, memberships, and build a direct relationship with your fans.”

It’s a great way to let your fanbase support you, through donations or through paying for content.

The only issue is, there isn’t any iOS integration. Today, we’re fixing that.

Our Tip Jar running on MacOS!

Let’s time to break down the Buy Me A Coffee Button.

We only need three things to create the button shown above. The logo, the text, and the color.

I’ve already searched around and found them for you, so here’s the download link.

Download the zip, unzip it, and you should have three files, BMCColor.colorset, BMCImage.imageset, and Cookie.ttf. Here’s what to do with them.

Go to Assets in your Xcode Project (Assets.xcassets) and drop both BMCColor and BMCImage there. They should transform into an Image asset and a Color asset.

Next, drop Cookie.ttf into your file manager, like shown in the image below.

How to add Cookie.ttf

Head to Info.plist now.

Add Fonts provided by application to your Info.plist, then set Item 0 to Cookie.ttf (shown below).

How to add the property to your Info.plist

We’ve officially added everything we need to get started. Now let’s get coding!

Here’s the final code to add the button. (Make sure to replace the placeholder with your Buy Me A Coffee URL!)

There you go! You’re all set. If you found this article helpful, you can Buy Me A Coffee

Thanks for reading!

--

--

Aditya Saravana

Stories and guides to indie development, software, and the tech industry.