# How do you increase font size for the text in an Alert Message

**URL:** <https://forums.kodeco.com/t/how-do-you-increase-font-size-for-the-text-in-an-alert-message/133774>\
**Category:** Swift\
**Created:** [February 27, 2021, 4:34am UTC](https://forums.kodeco.com/t/how-do-you-increase-font-size-for-the-text-in-an-alert-message/133774 "2021-02-27T04:34:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![elearner](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/elearner/32/109248_2.png) [@elearner](https://forums.kodeco.com/u/elearner)\
**Post date:** [February 27, 2021, 4:34am UTC](https://forums.kodeco.com/t/how-do-you-increase-font-size-for-the-text-in-an-alert-message/133774/1 "2021-02-27T04:34:40Z")

</div>

I just recently started working on the beginning “Your First iOS and SwiftUI App” video.  
I’ve been playing around with **specific “Modifiers”** one of which is for changing **font size**.  
Just using a Text View I’m able to alter the font size by using **.font(.largeType)**.  
This works every time for any font size that I choose.

I’ve tried to apply this same modifier to the title in an Alert View. Swift lets me add this modifier  
but it doesn’t allow the text size to change accordingly. So, what am I doing wrong or is it because the Alert View is limited in size and can’t be modified.

Thanks for your help.  
Gary

Here’s my code :

import SwiftUI

struct ContentView: View {  
@State private var showAlert: Bool = false  
var body: some View {  
VStack {  
Text(“My First App!”)  
**.font(.largeType)**  
.fontWeight(.semibold)  
.foregroundColor(.green)  
.padding(50)  
Button(action: {  
print(“Hit Me!”)

```
      self.showAlert = true
        
    }) {
      Text("Hit Me!")
        .padding()
    }
    .alert(isPresented: $showAlert) {
      () -> Alert in
      return Alert (title:Text("Hello World!")
                        
                       
                    , message: Text("This is my first pop-up.")
                      **.font(.largeType)**
                      , dismissButton: .default(Text("Super!")))
    }
  }
}

```

}

---

<div class="post-metadata">

**Author:** ![elliotw](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/elliotw/32/109228_2.png) [@elliotw](https://forums.kodeco.com/u/elliotw)\
**Post date:** [February 28, 2021, 8:06pm UTC](https://forums.kodeco.com/t/how-do-you-increase-font-size-for-the-text-in-an-alert-message/133774/2 "2021-02-28T20:06:09Z")

</div>

I’m 99% sure you can’t change the standard alert this way.

You’d have to create a custom alert 👍

---

<div class="post-metadata">

**Author:** ![elearner](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/elearner/32/109248_2.png) [@elearner](https://forums.kodeco.com/u/elearner)\
**Post date:** [March 4, 2021, 8:45pm UTC](https://forums.kodeco.com/t/how-do-you-increase-font-size-for-the-text-in-an-alert-message/133774/3 "2021-03-04T20:45:31Z")

</div>

Thanks for your reply. I’m now convinced that that’s true.

For views that can’t be altered, it seems like you should get an error message explaining why you can’t apply these modifiers. Instead, SwiftIU lets you apply modifiers to these types of "unchangeable " views as if they would work.

---

<div class="post-metadata">

**Author:** ![angelmarco](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/angelmarco/32/81494_2.png) [@angelmarco](https://forums.kodeco.com/u/angelmarco)\
**Post date:** [March 15, 2021, 1:26pm UTC](https://forums.kodeco.com/t/how-do-you-increase-font-size-for-the-text-in-an-alert-message/133774/4 "2021-03-15T13:26:46Z")

</div>

Can anyone tell me is there any way to change the font size for alrt messages

I tried with visual atrributes,property classes

All the size is same .No change .The color changes

please tell me any way to increase the size of alrt messages

Thanks

* * *

[Today Match Prediction](https://www.cricdip.com/) Get Live Ball by ball Today Cricket Live Match Score Card Auto Update,Who Will Win Today Match.

---

<div class="post-metadata">

**Author:** ![elianawilson](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/elianawilson/32/111721_2.png) [@elianawilson](https://forums.kodeco.com/u/elianawilson)\
**Post date:** [July 2, 2021, 1:21pm UTC](https://forums.kodeco.com/t/how-do-you-increase-font-size-for-the-text-in-an-alert-message/133774/5 "2021-07-02T13:21:42Z")

</div>

As far as I know, it is not possible.

However, you have a several choices:

If you want to create it yourself as a totally custom thing, create a new div element in your DOM (as the last child of the body, and give it the maximum z-index you can or you use), position that absolute (top:0,left:0), and write there HTML whatever you want. With some JS you can position it to center of the screen/layout. 🙂

Or use jQuery UI Dialog

---

<div class="post-metadata">

**Author:** ![jayantvarma](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jayantvarma/32/111768_2.png) [@jayantvarma](https://forums.kodeco.com/u/jayantvarma)\
**Post date:** [July 23, 2021, 8:44am UTC](https://forums.kodeco.com/t/how-do-you-increase-font-size-for-the-text-in-an-alert-message/133774/6 "2021-07-23T08:44:46Z")

</div>

@elianawilson @elearner is asking this question in the context of SwiftUI.

@elearner ,  
You cannot modify them via swiftUI, UIKit developers would try to subclass or extend the classes to change/modify the font sizes. However it is advised to leave it to system default as it will adapt based on the user settings.

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [August 12, 2021, 8:34pm UTC](https://forums.kodeco.com/t/how-do-you-increase-font-size-for-the-text-in-an-alert-message/133774/7 "2021-08-12T20:34:58Z")

</div>

This topic was automatically closed after 166 days. New replies are no longer allowed.
