| 1 | module ios |
| 2 | |
| 3 | import macos |
| 4 | |
| 5 | #flag -framework UIKit |
| 6 | #insert "@VEXEROOT/vlib/ios/uikit_bridge.h" |
| 7 | |
| 8 | fn C.ios_ui_application_main(argc int, argv &&char, principal voidptr, delegate voidptr) int |
| 9 | fn C.ios_color_from_hex(hex u32) voidptr |
| 10 | fn C.ios_color_from_hex_alpha(hex u32, alpha f64) voidptr |
| 11 | fn C.ios_index_path_row(index_path voidptr) i64 |
| 12 | fn C.ios_index_path_for_row(row i64, section i64) voidptr |
| 13 | |
| 14 | // Start the UIKit application run loop. |
| 15 | @[inline] |
| 16 | pub fn application_main(argc int, argv &&char, delegate_class_name string) int { |
| 17 | return C.ios_ui_application_main(argc, argv, unsafe { nil }, |
| 18 | macos.nsstring(delegate_class_name)) |
| 19 | } |
| 20 | |
| 21 | // Create a UIColor from a hex value (0xRRGGBB). |
| 22 | @[inline] |
| 23 | pub fn color(hex u32) macos.Id { |
| 24 | return C.ios_color_from_hex(hex) |
| 25 | } |
| 26 | |
| 27 | // Create a UIColor from a hex value with alpha. |
| 28 | @[inline] |
| 29 | pub fn color_alpha(hex u32, alpha f64) macos.Id { |
| 30 | return C.ios_color_from_hex_alpha(hex, alpha) |
| 31 | } |
| 32 | |
| 33 | // Get the row index from an NSIndexPath. |
| 34 | @[inline] |
| 35 | pub fn index_path_row(index_path macos.Id) int { |
| 36 | return int(C.ios_index_path_row(index_path)) |
| 37 | } |
| 38 | |
| 39 | // Create an NSIndexPath for a row in a section. |
| 40 | @[inline] |
| 41 | pub fn index_path(row int, section int) macos.Id { |
| 42 | return C.ios_index_path_for_row(i64(row), i64(section)) |
| 43 | } |
| 44 | |