OLD | NEW |
1 Sky | 1 Sky |
2 === | 2 === |
3 | 3 |
4 Sky is an experimental, high-performance UI framework for mobile apps. Sky helps | 4 For information about using Sky, please see the |
5 you create apps with beautiful user interfaces and high-quality interactive | 5 [Sky SDK](https://github.com/domokit/sky_sdk/). |
6 design that run smoothly at 120 Hz. | |
7 | 6 |
8 Sky consists of two components: | 7 For information about contributing to Sky, please see [HACKING.md](HACKING.md). |
9 | |
10 1. *The Sky engine.* The [engine](engine) is the core of the system system. | |
11 Written in C++, the engine provides the muscle of the Sky system. The engine | |
12 provides several primitives, including a soft real-time scheduler and a | |
13 hierarchial, retained-mode graphics system, that let you build high-quality | |
14 apps. | |
15 | |
16 2. *The Sky framework.* The [framework](framework) makes it easy to build apps | |
17 using Sky by providing familiar user interface widgets, such as buttons, | |
18 infinite lists, and animations, on top of the engine using Dart. These | |
19 extensible components follow a functional programming style inspired by | |
20 React. | |
21 | |
22 Sky is still experimental. We're experimenting with different ideas and | |
23 exploring various approaches, many of which won't work and will need to be | |
24 discarded, but, if we're lucky, some of which might turn out to be useful. | |
25 | |
26 Examples | |
27 -------- | |
28 | |
29 The simplest Sky app is, appropriately, HelloWorldApp: | |
30 | |
31 ```dart | |
32 import 'package:sky/framework/fn.dart'; | |
33 | |
34 class HelloWorldApp extends App { | |
35 Node build() { | |
36 return new Text('Hello, world!'); | |
37 } | |
38 } | |
39 | |
40 void main() { | |
41 new HelloWorldApp(); | |
42 } | |
43 ``` | |
44 | |
45 Execution starts in `main`, which creates the `HelloWorldApp`. The framework | |
46 then marks `HelloWorldApp` as dirty, which schedules it to build during the next | |
47 animation frame. Each animation frame, the framework calls `build` on all the | |
48 dirty components and diffs the virtual `Node` hierarchy returned this frame with | |
49 the hierarchy returned last frame. Any differences are then applied as mutations | |
50 to the physical heiarchy retained by the engine. | |
51 | |
52 For a more featureful example, please see the | |
53 [example stocks app](examples/stocks/lib/stocks_app.dart). | |
54 | |
55 Services | |
56 -------- | |
57 | |
58 Sky apps can access services from the host operating system using Mojo. For | |
59 example, you can access the network using the `network_service.mojom` interface. | |
60 Although you can use these low-level interfaces directly, you might prefer to | |
61 access these services via libraries in the framework. For example, the | |
62 `fetch.dart` library wraps the underlying `network_service.mojom` in an | |
63 ergonomic interface: | |
64 | |
65 ```dart | |
66 import 'package:sky/framework/net/fetch.dart'; | |
67 | |
68 void foo() { | |
69 fetch('example.txt').then((Response response) { | |
70 print(response.bodyAsString()); | |
71 }); | |
72 } | |
73 ``` | |
74 | |
75 Supported platforms | |
76 ------------------- | |
77 | |
78 Currently, Sky supports the Android and Mojo operating systems. | |
79 | |
80 Specifications | |
81 -------------- | |
82 | |
83 We're documenting Sky with a [set of technical specifications](specs) that | |
84 define precisely the behavior of the engine. Currently both the implementation | |
85 and the specification are in flux, but hopefully they'll converge over time. | |
86 | |
87 Contributing | |
88 ------------ | |
89 | |
90 Instructions for building and testing Sky are contained in [HACKING.md](HACKING.
md). | |
OLD | NEW |