Dev Notes

Dev Notes: January 24 - 30, 2025

Work

Android 16 Beta

The first beta of Android 16 has been released. Reading the release notes, so far a couple of things have caught my attention. First, the lack of haptic feedback APIs and the new ART compilation.

SwiftUI

Today I learned that you can use prompt inside TextField to customize its placeholder

TextField("", text: $authObservable.username, prompt: Text("Email Address").foregroundStyle(Color(.gray)))

So, with this in mind I guess we can do the same with searchable. Yep, it worked. Now I can set my own custom font.

.searchable(
	text: $searchTerm, isPresented: $searchIsFocused,
    placement: .navigationBarDrawer(displayMode: .automatic),
    prompt: Text("Search for a job")
)

So, I tried to compile it by adding a font() modifier but it threw a runtime error.

Only unstyled text can be used with init(text:isPresented:prompt:placement:control:)

But, as it turns out setting the font modifier after searchable will work.

.searchable(
	text: $searchTerm, isPresented: $searchIsFocused,
    placement: .navigationBarDrawer(displayMode: .automatic),
    prompt: Text("Search for a job")
).font(OnlineJobsFont.regularFont)