'I want to change the size of the locationbutton swiftUI

import CoreLocationUI  
LocationButton(.currentLocation, action: {
                        
            }).labelStyle(.iconOnly)

I didn't find helpful documentation for the new location button. please if there is any way to change the size of the button help me :(



Solution 1:[1]

Apple restricts the modification of this special button:

Consider customizing the location button to harmonize with your UI. Specifically, you can:

  • Choose the system-provided title that works best with your feature, such as “Current Location” or “Share My Current Location”
  • Choose the filled or outlined location glyph
  • Select a background color and a color for the title and glyph
  • Adjust the button’s corner radius

To help people recognize and trust location buttons, other visual attributes aren't customizable.

https://developer.apple.com/design/human-interface-guidelines/ios/app-architecture/accessing-user-data/

Solution 2:[2]

After going through the documentation again I figured out something that can help to make the button a little more bigger:

CoreLocationUI  
LocationButton(.currentLocation, action: {} )
              .labelStyle(.iconOnly)
              .font(.largeTitle)

For more details you can view this documentation https://sarunw.com/posts/location-button/#customization

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ChrisR
Solution 2 Noura