Skip to content

Commit

Permalink
docs: Improve README Formatting (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
ueman authored Feb 15, 2024
1 parent 682be77 commit fe7c2fc
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ In order to work correctly there needs to be some platform specific setup. Check
<details><summary>iOS</summary>

### Add a Widget to your App in Xcode
Add a widget extension by going `File > New > Target > Widget Extension`
Add a widget extension by going <kbd>File</kbd> > <kbd>New</kbd> > <kbd>Target</kbd> > <kbd>Widget Extension</kbd>

![Widget Extension](https://github.com/ABausG/home_widget/blob/main/.github/assets/widget_extension.png?raw=true)

Expand All @@ -30,19 +30,18 @@ You need to add a groupId to the App and the Widget Extension

**Note: in order to add groupIds you need a paid Apple Developer Account**

Go to your [Apple Developer Account](https://developer.apple.com/account/resources/identifiers/list/applicationGroup) and add a new group
Add this group to you Runner and the Widget Extension inside XCode `Signing & Capabilities > App Groups > +`
Go to your [Apple Developer Account](https://developer.apple.com/account/resources/identifiers/list/applicationGroup) and add a new group.
Add this group to your Runner and the Widget Extension inside XCode: <kbd>Signing & Capabilities</kbd> > <kbd>App Groups</kbd> > <kbd>+</kbd>.
(To swap between your App, and the Extension change the Target)

![Build Targets](https://github.com/ABausG/home_widget/blob/main/.github/assets/target.png?raw=true)

(To swap between your App, and the Extension change the Target)

### Sync CFBundleVersion (optional)
This step is optional, this will sync the widget extension build version with your app version, so you don't get warnings of mismatch version from App Store Connect when uploading your app.

![Build Phases](https://github.com/ABausG/home_widget/blob/main/.github/assets/build_phases.png?raw=true)

In your Runner (app) target go to `Build Phases > + > New Run Script Phase` and add the following script:
In your Runner (app) target go to <kbd>Build Phases</kbd> > <kbd>+</kbd> > <kbd>New Run Script Phase</kbd> and add the following script:
```bash
generatedPath="$SRCROOT/Flutter/Generated.xcconfig"
versionNumber=$(grep FLUTTER_BUILD_NAME $generatedPath | cut -d '=' -f2)
Expand Down Expand Up @@ -126,8 +125,10 @@ HomeWidgetPlugin.getData(context)

### Setup
<details><summary>iOS</summary>

For iOS, you need to call `HomeWidget.setAppGroupId('YOUR_GROUP_ID');`
Without this you won't be able to share data between your App and the Widget and calls to `saveWidgetData` and `getWidgetData` will return an error

</details>

### Save Data
Expand Down Expand Up @@ -231,13 +232,13 @@ Android and iOS (starting with iOS 17) allow widgets to have interactive Element
<details><summary>iOS</summary>

1. Adjust your Podfile to add `home_widget` as a dependency to your WidgetExtension
```
```rb
target 'YourWidgetExtension' do
use_frameworks!
use_modular_headers!

pod 'home_widget', :path => '.symlinks/plugins/home_widget/ios'
end
end
```
2. To be able to use plugins with the Background Callback add this to your AppDelegate's `application` function
```swift
Expand Down Expand Up @@ -575,4 +576,4 @@ HomeWidget.isRequestPinWidgetSupported();
Please add to this list if you have interesting and helpful resources
- [Google Codelab](https://codelabs.developers.google.com/flutter-home-screen-widgets#0)
- [Interactive HomeScreen Widgets with Flutter using home_widget](https://medium.com/p/83cb0706a417)
- [iOS Lockscreen Widgets with Flutter and home_widget](https://medium.com/p/0dfecc18cfa0)
- [iOS Lockscreen Widgets with Flutter and home_widget](https://medium.com/p/0dfecc18cfa0)

0 comments on commit fe7c2fc

Please sign in to comment.