|
1 | 1 | import Foundation |
2 | 2 | import NativeAPI |
3 | 3 |
|
4 | | -// MARK: - Main Program |
| 4 | +// MARK: - Simple AppRunner Example |
5 | 5 |
|
6 | | -print("=== NativeAPI Swift Example ===") |
| 6 | +print("=== NativeAPI AppRunner Simple Example ===") |
| 7 | +print("🚀 This demonstrates the simplest way to use AppRunner") |
7 | 8 | print() |
8 | 9 |
|
9 | | -// Test basic Display functionality |
10 | | -print("🚀 Testing NativeAPI Display...") |
11 | | - |
12 | | -AccessibilityManager.shared.enable() |
13 | | - |
14 | | -let isAccessibilityEnabled = AccessibilityManager.shared.isEnabled() |
| 10 | +// Method 1: Using the convenience function with default window |
| 11 | +print("📱 Method 1: Running app with default window") |
| 12 | +print("💡 This creates a default window and runs the application") |
| 13 | +print() |
15 | 14 |
|
16 | | -print("✅ Accessibility is enabled:", isAccessibilityEnabled) |
| 15 | +// Uncomment to try the simplest approach: |
| 16 | +// let exitCode = runApp() |
| 17 | +// print("✅ App exited with code: \(exitCode)") |
17 | 18 |
|
18 | | -let display = Display() |
19 | | -print("✅ Display instance created successfully!") |
| 19 | +// Method 2: Using custom window options |
| 20 | +print("📱 Method 2: Running app with custom window options") |
| 21 | +print("💡 This creates a window with specific options") |
20 | 22 | print() |
21 | 23 |
|
22 | | -print("📱 NativeAPI is working correctly!") |
23 | | -print("💡 This example demonstrates that the NativeAPI library can be imported and used.") |
| 24 | +// Create custom window options |
| 25 | +let options = WindowOptions() |
| 26 | +_ = options.setTitle("My Swift App") |
| 27 | +options.setSize(Size(width: 1000, height: 700)) |
| 28 | +options.setMinimumSize(Size(width: 500, height: 350)) |
| 29 | +options.setCentered(true) |
| 30 | + |
| 31 | +print("⚙️ Window options configured:") |
| 32 | +print(" - Title: 'My Swift App'") |
| 33 | +print(" - Size: 1000x700") |
| 34 | +print(" - Minimum size: 500x350") |
| 35 | +print(" - Centered on screen") |
24 | 36 | print() |
25 | 37 |
|
26 | | -print("🎯 Next steps:") |
27 | | -print(" - Implement more functionality in the NativeAPI module") |
28 | | -print(" - Add real display management features") |
29 | | -print(" - Test with actual display operations") |
30 | | -print() |
| 38 | +// Run with custom options |
| 39 | +let exitCodeWithOptions = runApp(with: options) |
| 40 | +print("✅ App exited with code: \(exitCodeWithOptions)") |
31 | 41 |
|
32 | | -print("✅ Example completed successfully!") |
| 42 | +print() |
| 43 | +print("🎉 Simple AppRunner example completed!") |
| 44 | +print("📝 This example showed:") |
| 45 | +print(" ✅ Simple one-line app launching") |
| 46 | +print(" ✅ Custom window configuration") |
| 47 | +print(" ✅ Exit code handling") |
| 48 | +print() |
| 49 | +print("💡 For more advanced features, see AppRunnerExample.swift") |
0 commit comments