The only solution I've been able to come up with so far is to record the CGRect of the view using GeometryReader then compare that rect against rect of the object of these notifications:
private var editingPublisher: AnyPublisher<Bool, Never> {
Publishers.Merge(
NotificationCenter.default
.publisher(for: UITextField.textDidBeginEditingNotification)
.map { notification in
guard
let textField = notification.object as? UITextField,
let originA = environmentObj.rectMap[id]?.origin,
let originB = textField.globalFrame?.origin,
originA.y == originB.y
else { return nil }
self.environmentObj.activeFrame = textField.globalFrame=
return true
},
NotificationCenter.default
.publisher(for: UITextField.textDidEndEditingNotification)
.map { notification in
guard
let textField = notification.object as? UITextField,
let originA = environmentObj.rectMap[id]?.origin,
let originB = textField.globalFrame?.origin,
originA.y == originB.y
else { return nil }
self.environmentObj.activeFrame = nil
return false
}
)
.compactMap { $0 }
.eraseToAnyPublisher()
Then add this modifier to the view:
.onReceive(editingPublisher) { isEditing in
		if isEditing { // set border thicker }
		else { // set border skinny }
}
However this solution is inelegant, inefficient, and it depends on a platform-specific API (UIKit) which means it won't work in a native macOS app without resorting to duplicating this logic separately for the Mac.
So that's why I'm here asking what is the correct way to do this? Surely there's a better way, right? What is it?