KinesteX

Admin Workout Editor

Embedded view for creating and managing workouts and exercises. As users interact with the editor, your application will receive events that you can handle to trigger custom logic.


Available for Flutter and Swift (iOS).


Custom Query Options (Flutter):

OptionDescription
hidePlansTabHide the plans tab in the dashboard
tabDefault tab: "workouts", "exercises", or "plans"
isSelectableMenuShow select button on cards, triggers _selected events

Available Events:


General Events:

  • kinestex_loaded - Application fully loaded
  • kinestex_launched - Successful authentication
  • error_occurred - Authentication error

Exercise Events:

  • exercise_opened - Exercise detail page opened
  • exercise_selection_opened - Exercise list page opened
  • exercise_selected - Exercise selected from menu
  • exercise_saved - Exercise created/updated
  • exercise_removed - Exercise removed from workout

Workout Events:

  • workout_opened - Workout detail page opened
  • workout_selection_opened - Workout list page opened
  • workout_selected - Workout selected from menu
  • workout_saved - Workout created/updated

Plan Events:

  • plan_opened - Plan detail page opened
  • plan_selection_opened - Plan list page opened
  • plan_selected - Plan selected from menu
  • plan_saved - Plan created/updated

Swift Parameters:

ParameterDescription
organization (required)Your organization identifier
contentType (optional).workout, .plan, or .exercise
contentId (optional)Specific content ID to edit
customQueries (optional)Additional query parameters
Admin Workout Editor Integration
Create the admin workout editor view for managing workouts and exercises:
Swift example:
1// Open main admin dashboard
2kinestex.createAdminWorkoutEditor(
3    organization: "YourOrg",
4    isLoading: $isLoading,
5    onMessageReceived: { message in
6        switch message {
7        case .exit_kinestex(_):
8            showEditor = false
9        default:
10            print("Message received: \(message)")
11        }
12    }
13)
14
15// Open specific workout for editing
16kinestex.createAdminWorkoutEditor(
17    organization: "YourOrg",
18    contentType: .workout,
19    contentId: "workout123",
20    isLoading: $isLoading,
21    onMessageReceived: { message in /* handle messages */ }
22)
23
24// Open specific exercise for editing
25kinestex.createAdminWorkoutEditor(
26    organization: "YourOrg",
27    contentType: .exercise,
28    contentId: "exercise456",
29    customQueries: ["language": "en"],
30    isLoading: $isLoading,
31    onMessageReceived: { message in /* handle messages */ }
32)
Complete Example
Full implementation with event handling:
Swift example:
1import SwiftUI
2import KinesteXAIKit
3
4struct AdminEditorView: View {
5    @State private var showEditor = false
6    @State private var isLoading = false
7
8    // Initialize KinesteXAIKit with your credentials
9    let kinestex = KinesteXAIKit(
10        apiKey: "YOUR_API_KEY",
11        companyName: "YOUR_COMPANY_NAME",
12        userId: "YOUR_USER_ID"
13    )
14
15    var body: some View {
16        VStack {
17            Text("Admin Editor")
18                .font(.title)
19                .padding()
20
21            Spacer()
22
23            Button(action: {
24                showEditor.toggle()
25            }) {
26                Text("Open Admin Editor")
27                    .font(.title3)
28                    .foregroundColor(.white)
29                    .bold()
30                    .padding()
31                    .frame(maxWidth: .infinity)
32                    .background(Color.blue.cornerRadius(10))
33                    .padding(.horizontal)
34            }
35
36            Spacer()
37        }
38        .fullScreenCover(isPresented: $showEditor) {
39            kinestex.createAdminWorkoutEditor(
40                organization: "YourOrg",
41                contentType: nil,
42                contentId: nil,
43                customQueries: nil,
44                isLoading: $isLoading,
45                onMessageReceived: { message in
46                    switch message {
47                    case .exit_kinestex(_):
48                        showEditor = false
49                    case .error_occurred(let data):
50                        print("Error: \(data)")
51                    default:
52                        print("Message received: \(message)")
53                    }
54                }
55            )
56        }
57    }
58}
59
60#Preview {
61    AdminEditorView()
62}