Home > Back-end >  I want to change the size of the locationbutton swiftUI
I want to change the size of the locationbutton swiftUI

Time:03-17

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 :(

CodePudding user response:

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/

CodePudding user response:

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

  • Related