Skip to main content

SwiftUI - custom navigation bar title

When managing a navigation title in Swift, you will have trodden down the path.  Previously you have entered something like

.navigationTitle("Title")

If you wanted to alter the font used for the navigation area, alter the init() in the view:

How to remove row separators from a Form or List in SwiftUI?

Struggling to hide the SwiftUI separators in a List or Form? 

 

The challenge

Creating the following form, separation lines appeared between NameLayout, FinalPhoto, RawPhoto, ApertureLayout and SubmitButton.

var body: some View {
    GeometryReader { geometry in
      Form {
        // layout elements
        NameLayout()
        FinalPhoto()
        RawPhoto()
        ApertureLayout()
        SubmitButton()
      }
    }
}

 

Core Data - customising the data model with a enum

Core Data - customising our data model

When you are using Core Data, and let's say that you have a requirement to have an attribute where the options available should be a defined list.  Such as "Not Started", "Pending", "In Development" and "Completed".  How do you create this as an option in Core Data?  

Xcode succeeded but nothing happens

I attempted the run command and the response I had was succeeded, but then nothing else happened!

I usually have this problem when a dependency is not updated.

The following steps usually works for me... note in bold are the Terminal commands such as (rm -rf Podfile.lock):

Cannot find '' in scope

When those simple annoyances are too frustrating!  Yes we have all been there and I was really hoping that Apple would have fixed what is obviously a bug.

SwiftUI - publishing changes from background threads is not allowed

The purple warning notification of annoyance recently came my way!  I received the following warning:

Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.

 

What was happening?

The functionality of the code uses URLSession to get a user's name via API and the display is simple piece that initially message of Hello {user}.

SwiftUI String to Binding<String> error

After creating a new view with a @Binding string as follows

struct EditRival: View {

  @Environment(\.presentationMode) var presentationMode
  @EnvironmentObject var realmPerson: RealmPersons
  @Binding var uid: String

 

The previews struct had an error with the var previews

Subscribe to SwiftUI