Integrating Buy Me A Coffee Into Your iOS Apps With SwiftUI

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

It’s a great way to earn by letting your fans support you, or even make exclusive content they can pay to get!

But…sometimes that person who uses Buy Me A Coffee is an app developer…

And there’s no iOS integration. Today, we’re fixing that!

Our Tip Jar running on MacOS!

Alright, so first, it’s time to break down the Buy Me A Coffee Button.

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

I had to do some searching to find them, but I’ll leave it here for you.

The button won’t work without completing these steps, so go-getters, stick around.

Color Set:

Image Set:

Text Font:

Here’s what to do with these three files.

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 officialy 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!)

Thanks for reading! If you’d like to Buy Me A Coffee, it’s down below. I’ll see you in the next one!

--

--

--

An eleven-year old designer and coder!

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Styling text with RichText Widget

LINE Friends Festival Gift Card

LINE Friends Festival Gift Card:螢幕截圖

How To Inspect an iOS App

iOS 16: WOW!

How to Create an iOS Project Without a Storyboard Using Xcode 11

Warhol: Face Detection Made Easy on iOS

SwiftUI vs Interface builder

Installing the Clean Swift Template in Xcode

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mr. SwiftUI

Mr. SwiftUI

An eleven-year old designer and coder!

More from Medium

Implement SwiftUI within UIKit

Swift + Combine: Getting Started

Fantastic Composing Gestures in SwiftUI

SwiftUI — Font templates made easy