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

[iOS] Add animation when you tap heartmark in timetable list. #944

Merged

Conversation

fumiyasac
Copy link
Contributor

@fumiyasac fumiyasac commented Sep 3, 2024

Issue

Overview

  • Enable to get tap position.
    • modify TimetableCard.swift
      • In order to calculate the value from GeometryReader, it is supported by assigning DragGesture to the Image element instead of Button.
      • The offset value in the Y-axis direction is subtracted for adjustment (decided by device orientation).
      • modify closure onTapFavorite: (TimetableItem, CGPoint?) -> Void.
  • Fix TimetableListView structure. (※ This View element is exceptionally not included in TCA.)
    • modify TimetableListView.swift
      • Calculate the offset value in the X-axis and Y-axis direction using GeometryReader.
      • Stack the heartmark elements that will be animated using ZStack.
      • When "isFavorited" is false and the state before ".favoriteTapped(timetableItemWithFavorite)", this view executes animation.

Points that seem difficult to achieve:

  1. Implementation to cover the Animation element over the TabBar's heartmark.
  2. To produce a movement that looks like an arc during animation.

Note

This is an experimental creation, so feel free to discard it if it doesn't meet your needs 🙇

Movie

Portrait:

Simulator.Screen.Recording.-.iPhone.15.-.2024-09-01.at.21.04.23.mp4

Landscape:

tap_heartmark_in_landscape.mov

}
Task {
try await Task.sleep(nanoseconds: 1_000_000_000)
targetTimetableItemId = nil
Copy link
Member

Choose a reason for hiding this comment

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

Can you fix this warning? 🙏🏼

capture of 'self' with non-sendable type 'TimetableListView' in a @Sendable closure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ry-itto I think you can solve it like this.

@MainActor
struct TimetableListView: View { ... }

@fumiyasac
Copy link
Contributor Author

@ry-itto I fixed warning. Please check it.

Copy link
Member

@ry-itto ry-itto left a comment

Choose a reason for hiding this comment

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

LGTM!

@ry-itto ry-itto merged commit aa38547 into DroidKaigi:main Sep 9, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iOS] Favorite registration micro-interaction for iOS
2 participants