 Would really appreciate it if anyone knows how to implement it or ideas on how to do it.
Would really appreciate it if anyone knows how to implement it or ideas on how to do it.
            Asked
            
        
        
            Active
            
        
            Viewed 3,333 times
        
    12
            
            
        - 
                    https://stackoverflow.com/questions/56505528/swiftui-update-navigation-bar-title-color may be from the answer you can get some idea – Prashant Tukadiya Jul 06 '20 at 12:51
- 
                    @ Prashant Tukadiya I have looked into this. But that is different. Thanks for sharing – pushpank Jul 06 '20 at 13:17
- 
                    1As of today SwiftUI is not mature enough for this functionality. You could only do it using UIKit or hiding the navigation bar on your view and then creating a custom look-alike view that stays on the top of your screen. Afterwards it is a hard play with the gestures. – DI.dev Jul 06 '20 at 13:41
- 
                    1I have already created it in UIkit. But not able to create it using swiftUI. – pushpank Jul 06 '20 at 14:51
- 
                    @pushpank Did you find the answer? I am looking for the same thing. – Tulon Jun 18 '21 at 17:53
2 Answers
0
            
            
        I can only answer for the first part, which is - How to set an image with in the title :
(in the navigationbar)
struct ContentView: View {
var body: some View {
            
    let array = ["thing 1", "thing 2", "thing 3", "others"]
    NavigationView{
        
        VStack(alignment: .leading) {
            
            ScrollView(.vertical){
                
                    ForEach(array, id: \.self) { item in
                            Text(item).font(.title).padding()
                    }
                }
            
            Spacer()
        }
        .navigationBarTitleDisplayMode(.inline)
                .toolbar {
                    ToolbarItem(placement: .principal) {
                            Text("Title")
                                .font(.title)
                    }
                    
                    ToolbarItem(placement: .navigationBarTrailing) {
                            Image(Constants.logoImage).resizable()
                                .scaledToFit()
                                .frame(width: 100, height: 50, alignment: .trailing)
                        }
                    }
    }
}
}
hope it helps!
maybe I'll add here the animation as well in the future if I'll get into it.
 
    
    
        Aviram Netanel
        
- 12,633
- 9
- 45
- 69
0
            
            
        use this approach
    NavigationView{
        
        VStack(alignment: .leading) {
            
            ScrollView(.vertical){
                
                    ForEach(list, id: \.self) { item in
                            Text(item).font(.title).padding()
                    }
                }
            
            Spacer()
        }
                .toolbar {
                    ToolbarItem(placement: .principal) {
                            Text("write something for title")
                                .font(.heavy)
                    }
                    
                    ToolbarItem(placement: .navigationBarTrailing) {
                            Image("image").resizable()
                                .scaledToFit()
                                .frame(width: 100, height: 50, alignment: .trailing)
                        }
                    }
    }
}
}
 
    
    
        Anup Kumar Mishra
        
- 1
- 2
- 22
