Widget example in iOS:
Example of the react-native(js) code written below:
import React from 'react';import { Text, View, NativeModules } from 'react-native';var Widget = NativeModules.Widget;const App = () => { return (<Widget><View style={{ justifyContent: 'center', alignItems: 'center', backgroundColor: '#dee1e3', borderRadius: 4, }}><Text>San Francisco</Text><Text style={{ fontSize: 30 }}>62°F</Text></View></Widget> );};export default App;
There is still not much documentation on creating widgets with Swift ui
for iOS 14
.
It wouldn't seem that difficult to create a widget using Swift ui
, but there isn't much information.
So I thought it would be interesting to develop the ui using react-native
and use swift ui
just to create the widget for iOS
.
Idea is this, everything inside the tag (let's call it that) <Widget>
(hence its child) should be the content of the Widget
.
I did not find anything in the documentation, I was wondering exists in Swift ui
or something for iOS
, to use child content as UI
for app.
Surely such a thing will be impossible, but dreaming costs nothing.