Quick Code Generation

Alex Sidebar provides inline code suggestions and completions directly in Xcode to help you write code faster.

Command + K

Trigger in-file suggestions to get AI-powered completions based on your current code context.

Tab Completion

Get real-time suggestions as you type. Press Tab to accept the highlighted suggestion.

Using Inline Completions

1

Trigger Suggestions

Position your cursor where you want to generate code (or select existing code) in Xcode and press Command + K K**

The AI analyzes your current file context to provide relevant suggestions

2

Select Model

Choose from available AI models for completion:

  • Claude 3.5 Sonnet: Advanced model for complex completions
  • GPT-4: Balanced performance and accuracy
  • Gemini Flash 2.0: Fast, lightweight completions

You can add additional models through the Model Settings, including:

  • Local models via Ollama integration
  • Custom API-compatible models
  • Other OpenAI-compatible endpoints

See the Model Configuration section for detailed setup instructions.

3

Review Options

  • Press Enter to accept the current suggestion
  • Press Esc to dismiss suggestions
  • Click retry button to generate new suggestions

Tab Completion

Best Practices

Model Selection

  • Use Claude 3.5 Sonnet for complex logic
  • Choose GPT-4 for balanced performance
  • Select Gemini Flash 2.0 for quick completions

Completion Tips

  • Use Command + K for larger completions
  • Try different models if results aren’t ideal
  • Use retry option for alternative suggestions
  • Tab complete for quick suggestions

SwiftUI Code Examples

Here are some practical examples of how Alex Sidebar’s inline suggestions work with SwiftUI code:

Start typing a basic SwiftUI view and let inline suggestions help:

struct ContentView: View {
  var body: some View {
    // Type "VStack", wait for a bit and then press TAB
    VStack(spacing: 16) {
      Text("Hello, World!")
        .font(.title)
        .foregroundColor(.blue)

      Button("Tap me") {
        // Suggestions will offer action implementations
      }
    }
  }
}

The examples above demonstrate common SwiftUI patterns where inline suggestions are particularly helpful. As you type these patterns, Alex Sidebar will suggest: - Property wrapper completions - View modifier chains - Common SwiftUI view structures - Closure completions

While AI suggestions are powerful, always review generated code to ensure it meets your requirements and follows your project’s conventions.

Was this page helpful?