Skip to content

Commit ea8a8ad

Browse files
committed
format
1 parent 0323f9a commit ea8a8ad

File tree

3 files changed

+25
-31
lines changed

3 files changed

+25
-31
lines changed

content/guide/widgets-ios.md

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ With NativeScript 8.9 CLI (`npm install -g nativescript`), you can create an iOS
1212
$ ns widget ios
1313
```
1414

15-
This will allow you to create a Home Screen Widget, a Live Activity on the lock screen or a combination of both.
15+
This will allow you to create a Home Screen Widget, a Live Activity on the lock screen or a combination of both.
1616

1717
## ns widget ios
1818

@@ -46,15 +46,15 @@ Followup steps:
4646

4747
Let's discuss each note by outlining everything that was generated:
4848

49-
- `App_Resources/iOS/app.entitlements`: Includes the App Groups capability for shared data between your app and widget. *If one doesn't exist, it will be created for you.*
49+
- `App_Resources/iOS/app.entitlements`: Includes the App Groups capability for shared data between your app and widget. _If one doesn't exist, it will be created for you._
5050
- `App_Resources/iOS/extensions/pizza/extension.json`: Xcode build configuration details. This is where additional frameworks, if desired, for your widget can also be included in the `frameworks` collection at the top.
5151
- `App_Resources/iOS/extensions/pizza/Info.plist`: The widget's info property list.
5252
- `App_Resources/iOS/extensions/pizza/pizza.entitlements`: Similar to the app.entitlements, this also includes the App Groups capability for shared data between your app and widget.
5353
- `App_Resources/iOS/extensions/pizza/PizzaBundle.swift`: This allows different widget features to be bundled together. For example, when choosing a Live Activity with a Home Screen Widget, both will be listed as part of the widget bundle here.
5454
- `App_Resources/iOS/extensions/pizza/PizzaHomeScreenWidget.swift`: The Home Screen Widget itself. This is where the view is defined as well as the [Timeline](https://developer.apple.com/documentation/widgetkit/timeline) which determines how data should be provided to the view. It comes already setup to use data from shared app/widget data which you can customize further.
5555
- `App_Resources/iOS/extensions/pizza/PizzaLiveActivity.swift`: The Live Activity to show on the lock screen. The view is defined via `LockScreenView` and also provides example customizations to the iPhone [Dynamic Island](https://support.apple.com/guide/iphone/use-the-dynamic-island-iph28f50d10d/ios).
5656
- `App_Resources/iOS/extensions/pizza/PrivacyInfo.xcprivacy`: The privacy policy for the widget. Refence documentation can be found [here](https://developer.apple.com/documentation/bundleresources/privacy-manifest-files).
57-
- `App_Resources/iOS/extensions/provisioning.json`: The provisioning profile configured to use with the widget id. On first generation, a placeholder is inserted however you can update this value to the provision profile needed.
57+
- `App_Resources/iOS/extensions/provisioning.json`: The provisioning profile configured to use with the widget id. On first generation, a placeholder is inserted however you can update this value to the provision profile needed.
5858

5959
::: tip Provisioning Profiles
6060
`open ~/Library/Developer/Xcode/UserData/Provisioning\ Profiles` and sort by modified date; this will allow you to find the profile id auto generated by xcode for your widget.
@@ -74,21 +74,21 @@ Your projects `references.d.ts` are also annotated to include strong types for `
7474
* Customize for your own Apple Widget Data
7575
*/
7676
declare interface AppleWidgetModelData {
77-
numberOfPizzas: number;
78-
totalAmount: string;
79-
message: string;
80-
deliveryTime: number;
77+
numberOfPizzas: number
78+
totalAmount: string
79+
message: string
80+
deliveryTime: number
8181
}
8282
declare class AppleWidgetUtils extends NSObject {
83-
static startActivity(data: AppleWidgetModelData): void;
83+
static startActivity(data: AppleWidgetModelData): void
8484
static updateActivity(
85-
data: Pick<AppleWidgetModelData, "message" | "deliveryTime">
86-
): void;
87-
static cancelActivity(data: Pick<AppleWidgetModelData, "message">): void;
88-
static updateWidget(): void;
89-
static updateDataWithKey(key: string, data: string): void;
90-
static getDataWithKey(key: string): string;
91-
static removeDataWithKey(key: string): void;
85+
data: Pick<AppleWidgetModelData, 'message' | 'deliveryTime'>
86+
): void
87+
static cancelActivity(data: Pick<AppleWidgetModelData, 'message'>): void
88+
static updateWidget(): void
89+
static updateDataWithKey(key: string, data: string): void
90+
static getDataWithKey(key: string): string
91+
static removeDataWithKey(key: string): void
9292
}
9393
```
9494

@@ -98,19 +98,13 @@ All shared group data between your app and widget are intended to be a string va
9898

9999
```ts
100100
AppleWidgetUtils.updateDataWithKey(
101-
"widgetData",
101+
'widgetData',
102102
JSON.stringify({
103-
pizzas: [
104-
"Pepperoni",
105-
"Supreme",
106-
"Hawaiian",
107-
"Meat Lovers",
108-
"Margherita",
109-
],
103+
pizzas: ['Pepperoni', 'Supreme', 'Hawaiian', 'Meat Lovers', 'Margherita'],
110104
orderTime: this.orderTime(),
111105
delivered: false,
112106
})
113-
);
107+
)
114108
```
115109

116110
This data is always decoded in the widget for it's own data purposes.
@@ -126,10 +120,12 @@ A helpful sample project is available [here](https://github.com/NativeScript/wid
126120
## Resources
127121

128122
Additional features can be discussed anytime:
123+
129124
- https://github.com/orgs/NativeScript/discussions
130125
- https://github.com/NativeScript/NativeScript/issues/10703
131126

132127
Widget extensions have been supported with NativeScript for several years. Prior to 8.9, they required a number of manual steps. We'll include the following resources for additional context:
128+
133129
- https://blog.nativescript.org/add-home-screen-widget
134130
- https://www.bryanleetc.com/creating-a-share-extension-in-nativescript/
135131
- https://blog.nativescript.org/making-a-today-widget-in-ios-with-nativescript-and-ui-for-nativescript
@@ -141,7 +137,7 @@ Several common cases could occur while developing widgets.
141137

142138
### Minimum version targeting
143139

144-
The widget generator expects iOS 17 minimum.
140+
The widget generator expects iOS 17 minimum.
145141

146142
If you encounter errors similar to the following:
147143

@@ -154,4 +150,3 @@ Add the following line to your `App_Resources/iOS/build.xcconfig`:
154150
```
155151
IPHONEOS_DEPLOYMENT_TARGET = 17;
156152
```
157-

content/ui/action-bar.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ By default, a border is drawn at the bottom of the ActionBar. In addition to the
8787
You can alternatively use `iosShadow="false"` in the event you want to keep the translucency but remove the border.
8888
:::
8989

90-
9190
```xml
9291
<ActionBar title="MyApp" iosShadow="false" />
9392
```

content/ui/text-view.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,23 +123,23 @@ Enables or disables autocorrect.
123123
(iOS Only) Are Apple Intelligence writing tools active.
124124

125125
```ts
126-
isWritingToolsActive: boolean;
126+
isWritingToolsActive: boolean
127127
```
128128

129129
### enableWritingToolsEvents 8.9+
130130

131131
(iOS Only) Allow Apple Intelligence writing tools to emit text changes on each alteration instead of after the final change (default).
132132

133133
```ts
134-
enableWritingToolsEvents: boolean;
134+
enableWritingToolsEvents: boolean
135135
```
136136

137137
### iosWritingToolsBehavior 8.9+
138138

139139
(iOS Only) Behavior for Apple Intelligence Writing Tools.
140140

141141
```ts
142-
iosWritingToolsBehavior: WritingToolsBehavior;
142+
iosWritingToolsBehavior: WritingToolsBehavior
143143
```
144144

145145
Can be `Default`, `Complete`, `Limited` or `None`.
@@ -149,7 +149,7 @@ Can be `Default`, `Complete`, `Limited` or `None`.
149149
(iOS Only) Allowed input for Apple Intelligence Writing Tools.
150150

151151
```ts
152-
iosWritingToolsAllowedInput: Array<WritingToolsAllowedInput>;
152+
iosWritingToolsAllowedInput: Array<WritingToolsAllowedInput>
153153
```
154154

155155
Can be `Default`, `List`, `PlainText`, `RichText` or `Table`.

0 commit comments

Comments
 (0)