Alert with custom Font

Abdulmagid Elmaghbub
2 min readJan 20, 2021

Customizing the Alert Title & Body

this extension is made by the admin at www.swiftdevcenter.com but needed to make some adjustments to make it work on xcode12/swift5

how to use it

Note “BahijTheSansArabic-Plain” is my custom font

Customizing the UIAlertAction Font

this one was complicated and after a lot of research i found this on solution from a gay on StackOverflow named Farhad Faramarzi.

the thing about the actions that they get generated in run time before that they simply don’t exist so you cant change what is not there, aaaaand that is why this solution targets the alertActions after they get generated in the viewDidLayoutSubviews() method, as so

in this one you just need to change the Font in the extension it self

A BIG note the font on the buttons will not change if you are running the app form the Xcode, instead you need to run the app from the xcode then stop it then go back and open it manually.
unless you have an iPhone 5s it will just work because of Magic 🧙🏻‍♂️

i hope you find this helpfull and big shoutout to Farhad Faramarzi. and www.swiftdevcenter.com

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Abdulmagid Elmaghbub
Abdulmagid Elmaghbub

Responses (1)

Write a response