|
Hi all, I was wondering if there is a way to embed icons into the NavigationView title bar, inline with the title, the way the stock Messages app has it. I've seen EDIT: For reference, here is an image of what I'm aiming to achieve, vs what I'm able to achieve. Thanks a lot, jakcharvat |
|
I have hacked some code together for you. I know that there probably is a way more elegant way of doing this but it works. It does need a lot of tweeking but hopefully it will start you on your way. If anyone can improve on this or show the correct way of doing it, i'd be interested in learning how.
|
|
Hi, thanks for the quick reply. Definitely not as clean as I was hoping (I hoped for some out-of-the-box implementation I was missing), but it's definitely a good start. Thank you very much, I'll see if I can improve on it a bit (especially since the Navbar title is sitting under the Navbar itself right now and a few animations). |
|
There is a simpler way by using navigation bar items. That can be leading or trailing the title. Try this and let me know if it worked .navigationBarItems(leading: Image("your image name").resizable().frame(width:40, height:40, alignment: .center).cornerRadius(20)) |
|
I maybe late but you could add a center title, image etc:
|
SPONSORED Still waiting on your CI build? Speed it up ~3x with Blaze - change one line, pay less, keep your existing GitHub workflows. First 25 HWS readers to use code HACKING at checkout get 50% off the first year. Try it now for free!
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.