This sample was me experimenting with Swift's C interop (which is WinRT delegates as closures, and then using Swift's idiomatic One thing that turns out very nice in Swift is projecting MazeGameĪs mentioned above, this one is just a straight port of a Microsoft Which I consider to be a pleasant outcome. Resulting in a code that is rather similar to C#, The projection for asynchronous WinRT methods uses Swift await, Let httpResponseBody = try await httpResponse.Content!.ReadAsString() Let _ = try httpResponse.EnsureSuccessStatusCode() Let httpResponse = try await httpClient.Get(uri: requestUri)! This sample is short enough to just include all the code right here: Physics is a little app that simply brings up a window with 3 balls bouncing around, further demonstrating the use of Win2D, and also showing C interop with the Chipmunk2D physics engine.Ĭalc is a WinUI 3 app, demonstrating the use of controls such as TextBox and ListView with Windows App SDK 1.1.1. MazeGame is a port of, demonstrating the use of Win2D from Swift. HttpClient is a console app, demonstrating the use of, and showing how async WinRT calls are projected using Swift's async/await features. Here in this blog post, I want to highlight four of them: I am accumulating a collection of samples in the repo. In fact, my working repo linkedĪbove is a fork of his repo where he did some experimental work in this area. Saleem Abdulrasool (GitHub: of the Swift Core Team. No discussion of Swift on Windows would be complete without mention of Swift is also considered very pleasant to use, comparable toĬ# in terms of overall developer experience. Reference Counting (ARC) makes it a natural fit for WinRT, whichĪlso uses reference counting for memory management. Its cross-platform presence is growing, and its use of Automatic Swift is a language mostly associated with Apple platforms, but Underpinnings remain solid, and it is quite feasible to develop a WinRT The languages getting the most traction are C++, C#, and Rust, while some Nowadays, the broader aspects of xlang don't seem to have a lot of momentum. That enable development of Windows applications across a variety of programming languages": A few yearsĪgo, Microsoft created the "xlang" project as "the hub for the constellation of tools The nice thing about WinRT is that it isĭesigned to be used from a variety of programming languages. Modern Windows APIs are based on WinRT, which is based on COM, which hasĪ long history at Microsoft. The code for the generated bindings, support libraries, and This effort is currently taking place in the following repo: My exploration of interop between Microsoft ThingsĪnd Other Things has brought me to work on creating a Swift
0 Comments
Leave a Reply. |