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

[linear-gradient][ios] Rewrite entire module to Swift #15168

Merged
merged 5 commits into from
Nov 15, 2021

Conversation

tsapeta
Copy link
Member

@tsapeta tsapeta commented Nov 12, 2021

Why

Previously only the module has been rewritten to Swift. Also we kept the legacy Objective-C implementation for one SDK cycle, so it can be removed now.

How

  • Deleted legacy Objective-C implementation
  • Renamed pod from EXLinearGradient to ExpoLinearGradient — following in ExpoModulesCore and ExpoSystemUI footsteps
  • Deleted unimodule.json (expo-module.config.json exists)
  • Rewrote view and layer implementations using Swift
  • For convenience replaced prop value types to convertible types
    • Int in "colors" prop replaced with CGColor
    • Array of point coordinates replaced with CGPoint
    • Double replaced with CGFloat
  • After making some props optional, it turned out that NSNull parsed from JSON is not properly bridged to Swift's nil, so I fixed fromNSObject function
  • Documented default values for start, end, locations props

Test Plan

NCL screen for LinearGradient seems to work as expected

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Nov 12, 2021
@tsapeta tsapeta force-pushed the @tsapeta/ios/rewrite-linear-gradient branch from debbba4 to 513a2e1 Compare November 12, 2021 22:31
@expo-bot
Copy link
Collaborator

Hi there! 👋 I'm a bot whose goal is to ensure your contributions meet our guidelines.

I've found some issues in your pull request that should be addressed (click on them for more details) 👇

⚠️ Suggestion: Missing changelog entries


Your changes should be noted in the changelog. Read Updating Changelogs guide and consider (it's optional) adding an appropriate entry to the following changelogs:


Generated by ExpoBot 🤖 against 513a2e1

@tsapeta tsapeta marked this pull request as ready for review November 12, 2021 23:28
@tsapeta tsapeta requested a review from brentvatne as a code owner November 12, 2021 23:28
@tsapeta tsapeta requested a review from lukmccall November 15, 2021 09:09
Copy link
Contributor

@lukmccall lukmccall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀


if let gradient = CGGradient(colorsSpace: colorSpace, colors: colors as CFArray, locations: locations) {
let size = bounds.size

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

You don't have to remove that line, but it looks odd to me 🤷‍♂️

@tsapeta tsapeta merged commit 3f7d35e into master Nov 15, 2021
@tsapeta tsapeta deleted the @tsapeta/ios/rewrite-linear-gradient branch November 15, 2021 14:48
DominickVale pushed a commit to DominickVale/expo that referenced this pull request Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: suggestions ExpoBot has some suggestions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants