OLD | NEW |
1 Sky SDK | 1 Sky |
2 ======= | 2 === |
3 | 3 |
| 4 Sky is an experimental, high-performance UI framework for mobile apps. Sky helps |
| 5 you create apps with beautiful user interfaces and high-quality interactive |
| 6 design that run smoothly at 120 Hz. |
| 7 |
| 8 Sky consists of two components: |
| 9 |
| 10 1. *The Sky engine.* The engine is the core of the system system. Written in |
| 11 C++, the engine provides the muscle of the Sky system. The engine provides |
| 12 several primitives, including a soft real-time scheduler and a hierarchial, |
| 13 retained-mode graphics system, that let you build high-quality apps. |
| 14 |
| 15 2. *The Sky framework.* The [framework](packages/sky/lib/framework) makes it |
| 16 easy to build apps using Sky by providing familiar user interface widgets, |
| 17 such as buttons, infinite lists, and animations, on top of the engine using |
| 18 Dart. These extensible components follow a functional programming style |
| 19 inspired by [React](http://facebook.github.io/react/). |
| 20 |
4 We're still iterating on Sky heavily, which means the framework and underlying | 21 We're still iterating on Sky heavily, which means the framework and underlying |
5 engine are both likely to change in incompatible ways several times, but if | 22 engine are both likely to change in incompatible ways several times, but if |
6 you're interested in trying out the system, this document can help you get | 23 you're interested in trying out the system, this document can help you get |
7 started. | 24 started. |
8 | 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 more examples, please see the [examples directory](examples/). |
| 53 |
| 54 Services |
| 55 -------- |
| 56 |
| 57 Sky apps can access services from the host operating system using Mojo. For |
| 58 example, you can access the network using the `network_service.mojom` interface. |
| 59 Although you can use these low-level interfaces directly, you might prefer to |
| 60 access these services via libraries in the framework. For example, the |
| 61 `fetch.dart` library wraps the underlying `network_service.mojom` in an |
| 62 ergonomic interface: |
| 63 |
| 64 ```dart |
| 65 import 'package:sky/framework/net/fetch.dart'; |
| 66 |
| 67 void main() { |
| 68 fetch('example.txt').then((Response response) { |
| 69 print(response.bodyAsString()); |
| 70 }); |
| 71 } |
| 72 ``` |
| 73 |
9 Set up your computer | 74 Set up your computer |
10 -------------------- | 75 -------------------- |
11 | 76 |
12 1. Install the Dart SDK: | 77 1. Install the Dart SDK: |
13 - https://www.dartlang.org/tools/download.html | 78 - https://www.dartlang.org/tools/download.html |
14 | 79 |
15 2. Install the ``adb`` tool from the Android SDK: | 80 2. Install the ``adb`` tool from the Android SDK: |
16 - https://developer.android.com/sdk/installing/index.html | 81 - https://developer.android.com/sdk/installing/index.html |
17 | 82 |
18 3. Install the Sky SDK: | 83 3. Install the Sky SDK: |
19 - ``git clone https://github.com/domokit/sky_sdk.git`` | 84 - ``git clone https://github.com/domokit/sky_sdk.git`` |
20 | 85 |
21 4. Ensure sure $DART_SDK is set to the path of your Dart SDK and 'adb' | 86 4. Ensure sure $DART_SDK is set to the path of your Dart SDK and 'adb' |
22 (inside 'platform-tools' in the android sdk) is in your $PATH. | 87 (inside 'platform-tools' in the android sdk) is in your $PATH. |
23 | 88 |
24 Set up your device | 89 Set up your device |
25 ------------------ | 90 ------------------ |
26 | 91 |
27 Currently Sky requires an Android device running the Lollipop (or newer) version | 92 Currently Sky requires an Android device running the Lollipop (or newer) version |
28 of the Android operating system. | 93 of the Android operating system. |
29 | 94 |
30 1. Enable developer mode on your device by visiting ``Settings > About phone`` | 95 1. Enable developer mode on your device by visiting ``Settings > About phone`` |
31 and tapping the ``Build number`` field five times. | 96 and tapping the ``Build number`` field five times. |
32 | 97 |
33 2. Enable ``USB debugging`` in ``Settings > Developer options``. | 98 2. Enable ``USB debugging`` in ``Settings > Developer options``. |
34 | 99 |
35 3. Using a USB cable, plug your phone into your computer. If prompted on your | 100 3. Using a USB cable, plug your phone into your computer. If prompted on your |
36 device, authorize your computer to access your device. | 101 device, authorize your computer to access your device. |
37 | 102 |
38 Running a Sky application | 103 Running a Sky application |
39 ------------------------- | 104 ------------------------- |
40 | 105 |
41 1. ``sky_sdk/bin/sky --install sky_sdk/examples/index.sky`` | 106 1. ``packages/sky/lib/sky_tool --install examples/stocks/main.sky`` |
42 The --install flag is only necessary the first time to install SkyDemo.apk. | 107 The --install flag is only necessary the first time to install SkyDemo.apk. |
43 | 108 |
44 2. Use ``adb logcat`` to view any errors or Dart print() output from the app. | 109 2. Use ``adb logcat`` to view any errors or Dart print() output from the app. |
OLD | NEW |