elm-native-library/README.md

67 lines
2.1 KiB
Markdown
Raw Normal View History

2023-01-18 09:47:46 +03:00
# Elm Native
2023-01-18 09:50:40 +03:00
2023-03-04 12:07:36 +03:00
Build mobile apps with elm using NativeScript API. `elm/http` works with this library as well!
We can build simple apps like counter
2023-03-04 12:07:36 +03:00
![Counter](./doc/counter.gif)
or something like a blog
2023-03-04 12:07:36 +03:00
![Counter](./doc/blog.gif)
or even complex app with page transitions, modals, dialog, and much more!
2023-01-18 09:50:40 +03:00
![Car details](./doc/car.gif)
2023-02-24 15:18:09 +03:00
2023-03-04 12:49:01 +03:00
## How it works
We will use [CustomElements](https://guide.elm-lang.org/interop/custom_elements.html) feature to create mobile UI elements with nativescript objects and control the nativescript object from elm.
Here's a simple representation of how UI elements are created
`Elm` -> `Nativescript` -> `Mobile`
When we listen for / receive an event,
`Mobile` -> `Nativescript` -> `Elm`
Consider this flow while building an application. This will help you to overcome performance issues if you encounter them.
2023-03-04 15:44:56 +03:00
Use the attributes from `Native.Attributes` and NOT `Html.Attributes`
2023-03-04 12:49:01 +03:00
### Supported Features
- Dialog
- Page transitions animations
- Modal page
- Execution of OS specific property assignment and Native code (Be careful)
- Navigating page back and forth using frame functions
- Has bindings for all Nativescript UI elements
- Calling methods/setting attributes in the event object within elm (Will be improved in future)
2023-03-04 12:51:17 +03:00
- Simple and complex listviews templates and much more
2023-03-04 12:49:01 +03:00
More features will be added soon.
2023-03-04 17:36:29 +03:00
This project tooks months of research and days of work. If you feel like it is valuable to the elm community, **[please consider supporting this project](https://github.com/sponsors/hariroshan)**
2023-03-04 17:34:23 +03:00
## Get Started
1. Clone the blank template
```sh
git clone https://github.com/hariroshan/template-blank-elm
```
2. Install dependencies using `yarn` or `npm install`
2023-03-04 17:53:21 +03:00
3. Follow the instructions to setup your [mobile development enviroment](https://docs.nativescript.org/environment-setup.html)
4. Run project using
- `yarn run run:ios` or `npm run run:ios` for iOS
- `yarn run run:android` or `npm run run:android` for Android
2023-03-04 17:34:23 +03:00
2023-02-24 15:21:47 +03:00
## TODO
2023-03-04 12:49:01 +03:00
- [ ] Convert raw js into rescript
- [ ] Build a starter template with elm support with bindings pre-installed
- [ ] Support animations