| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 778a993 commit 09f1a18
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,18 +20,25 @@ with the native UI through a versioned bridge. | |||
| 20 | 20 | ||
| 21 | 21 | Yes. Two patterns: | |
| 22 | 22 | ||
| 23 | - - **Branch on `IS_ANDROID` / `IS_IOS`** for small differences inside | ||
| 24 | - a shared component: | ||
| 23 | + - **Branch on `IS_ANDROID` / `IS_IOS` / `IS_DESKTOP`** for small | ||
| 24 | + differences inside a shared component: | ||
| 25 | 25 | ||
| 26 | 26 | ```python | |
| 27 | - from pythonnative.utils import IS_ANDROID, IS_IOS | ||
| 27 | + from pythonnative.utils import IS_ANDROID, IS_IOS, IS_DESKTOP | ||
| 28 | 28 | ||
| 29 | 29 | if IS_ANDROID: | |
| 30 | 30 | ... | |
| 31 | 31 | elif IS_IOS: | |
| 32 | 32 | ... | |
| 33 | + elif IS_DESKTOP: | ||
| 34 | + ... | ||
| 33 | 35 | ``` | |
| 34 | 36 | ||
| 37 | + `pn preview` runs the app with `IS_DESKTOP` set; see the | ||
| 38 | + [Desktop preview guide](../guides/desktop-preview.md). | ||
| 39 | + For a declarative alternative, use `Platform.select({...})`; see the | ||
| 40 | + [Platform API](../api/platform.md). | ||
| 41 | + | ||
| 35 | 42 | - **Per-platform native modules** for larger pieces (a custom widget, | |
| 36 | 43 | a device API). Implement once per platform behind a single Python | |
| 37 | 44 | facade. See [Native modules guide](../guides/native-modules.md). | |
| Back | FazBrowse Home | New Git URL |
0 commit comments