Browse Questions
  • Prevent Core Foundation memory leaks in Swift by correctly balancing Unmanaged<T>.passRetained() with takeRetainedValue() and pairing every retained C-level allocation with CFRelease.
  • Both manage concurrent work, but async/await (introduced in Swift 5.5) is structured and compiler-checked, while GCD is unstructured and callback-based.
  • Use .onTapGesture for standard taps, and .onSimultaneousGesture when you need two gestures to fire together without one cancelling the other.
  • Secure Session is Themis's stateful encrypted channel: peers perform a handshake, derive ephemeral session keys, and then exchange messages with forward secrecy over any transport you supply.

Use .onTapGesture for standard taps, and .onSimultaneousGesture when you need two gestures to fire together without one cancelling the other.

Use .onTapGesture when:

  • A button-like element (e.g., chat bubble, emoji button)
  • Opening a bottom sheet
  • Selecting an item from a list
  • Toggling a state (expand/collapse)

Use .onSimultaneousGesture when:

  • A scroll view needs a tap gesture (avoid losing scrolling)
  • A draggable view that still detects taps
  • A long press that shouldn't block taps
  • Multi-gesture components (like a map: drag + tap markers)
// Standard tap — cancels scroll gesture
ScrollView {
    Text("Hello")
        .onTapGesture { print("tapped") }  // blocks scroll in some cases
}

// Simultaneous — both gestures fire independently
ScrollView {
    Text("Hello")
        .onSimultaneousGesture(TapGesture().onEnded {
            print("tapped without blocking scroll")
        })
}

Common Misunderstanding:

.onSimultaneousGesture is not a replacement for .onTapGesture.

ModifierPurpose
.onTapGestureDetecting taps — exclusive, can cancel competing gestures
.onSimultaneousGestureCombining gestures without conflict — both fire at once

Use .onTapGesture by default. Only switch to .onSimultaneousGesture when you notice a parent gesture (like ScrollView) is being blocked.