Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change pod dependencies SwiftUI and Combine to weak to ensure compatibility with iOS 12 #2219

Conversation

florianrhein
Copy link
Contributor

@florianrhein florianrhein commented Oct 19, 2023

Since SwiftUI was added to lottie-ios, it no longer runs on iOS 12 devices when embedded through CocoaPods. The runtime error encountered on iOS 12:

dyld: Library not loaded: /System/Library/Frameworks/SwiftUI.framework/SwiftUI
Referenced from: /private/var/containers/Bundle/Application/[...]/Frameworks/Lottie.framework/Lottie
Reason: image not found

The reason for this is, that CocoaPods automatically adds strong dependencies to any used frameworks, unless otherwise specified.

With this PR, we specifically add SwiftUI and Combine as weak dependencies, meaning that projects embedding lottie-ios as pod are not required to embed SwiftUI and Combine.
Additionally, all files using SwiftUI are prefixed with a canImport(SwiftUI).

@calda
Copy link
Member

calda commented Oct 19, 2023

Thanks for the fix, this seems reasonable mostly reasonable to me. I wonder how much longer we need to support iOS 12 and earlier -- at some point it will make sense to drop support for those old versions, which will avoid the need for this.

Looks like the build is macOS build is currently failing, so that will need to be fixed.

@calda
Copy link
Member

calda commented Oct 20, 2023

Thanks!

Can you think of a way to test that this works as expected within having to build and run an app on an iOS 12 simulator? I'd like to set up a test case for this in CI if possible.

@calda calda merged commit 73280cb into airbnb:master Oct 20, 2023
15 checks passed
@florianrhein
Copy link
Contributor Author

No, I'm afraid including the pod on a device or simulator actually running iOS 12 is the only way to test this...

@florianrhein florianrhein deleted the weakly-import-swiftui-for-ios-12-compatability branch October 26, 2023 15:02
cgrindel-self-hosted-renovate bot referenced this pull request in cgrindel/rules_swift_package_manager Dec 4, 2023
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [airbnb/lottie-spm](https://togithub.com/airbnb/lottie-spm) | patch |
`from: "4.3.3"` -> `from: "4.3.4"` |

---

### Release Notes

<details>
<summary>airbnb/lottie-spm (airbnb/lottie-spm)</summary>

###
[`v4.3.4`](https://togithub.com/airbnb/lottie-spm/releases/tag/4.3.4)

[Compare
Source](https://togithub.com/airbnb/lottie-spm/compare/4.3.3...4.3.4)

#### What's Changed

- Fix parsing regression in 4.3.0 from addition of parsing layer effects
by [@&#8203;calda](https://togithub.com/calda) in
[https://github.com/airbnb/lottie-ios/pull/2208](https://togithub.com/airbnb/lottie-ios/pull/2208)
- Remove old animation layer when creating a new animation layer by
[@&#8203;junjielu](https://togithub.com/junjielu) in
[https://github.com/airbnb/lottie-ios/pull/2214](https://togithub.com/airbnb/lottie-ios/pull/2214)
- Add configuration setting to remove animated bounds changes by
[@&#8203;thedrick](https://togithub.com/thedrick) in
[https://github.com/airbnb/lottie-ios/pull/2218](https://togithub.com/airbnb/lottie-ios/pull/2218)
- Change pod dependencies `SwiftUI` and `Combine` to `weak` to ensure
compatibility with iOS 12 by
[@&#8203;florianrhein](https://togithub.com/florianrhein) in
[https://github.com/airbnb/lottie-ios/pull/2219](https://togithub.com/airbnb/lottie-ios/pull/2219)
- Fix issue where Repeater would be ignored if not at top level by
[@&#8203;calda](https://togithub.com/calda) in
[https://github.com/airbnb/lottie-ios/pull/2221](https://togithub.com/airbnb/lottie-ios/pull/2221)
- Replace `UIScreen.main` to get display scale on iOS 13.0 and later
([#&#8203;2215](https://togithub.com/airbnb/lottie-spm/issues/2215)) by
[@&#8203;hyun99999](https://togithub.com/hyun99999) in
[https://github.com/airbnb/lottie-ios/pull/2216](https://togithub.com/airbnb/lottie-ios/pull/2216)
- Dispatch dot lottie file loading onto a single serial queue by
[@&#8203;erichoracek](https://togithub.com/erichoracek) in
[https://github.com/airbnb/lottie-ios/pull/2229](https://togithub.com/airbnb/lottie-ios/pull/2229)
- Clean up unused property in InvertedMatteLayer by
[@&#8203;hanton](https://togithub.com/hanton) in
[https://github.com/airbnb/lottie-ios/pull/2241](https://togithub.com/airbnb/lottie-ios/pull/2241)
- Fix issue where LottieView animation would restart from beginning
after backgrounding app by [@&#8203;calda](https://togithub.com/calda)
in
[https://github.com/airbnb/lottie-ios/pull/2237](https://togithub.com/airbnb/lottie-ios/pull/2237)

**Full Changelog**:
airbnb/lottie-ios@4.3.3...4.3.4

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
iago849 pushed a commit to atteamapps/lottie-ios that referenced this pull request Feb 8, 2024
MoroziOS pushed a commit to MoroziOS/tmg-lottie-ios that referenced this pull request May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants