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

Pura Interview Challenge #24

Open
wants to merge 34 commits into
base: main
Choose a base branch
from

Conversation

patch-benjamin
Copy link

@patch-benjamin patch-benjamin commented Sep 30, 2024

Simulator.Screen.Recording.-.iPhone.16.Pro.-.2024-09-29.at.23.56.56.mp4

OVERVIEW:
I made several significant changes in this code challenge. I went over the 2-4 hour time box, but I'll mark where 4 hours would have been for your reference. The commit history should be pretty easy to glance over (though is not super descriptive).

The app approach I went with for my changes was to make a kind of Frayer Model app that shows you the definition, images, synonyms, and lets you write notes on your take aways.

STEPS TAKEN:

  • Converted API to use Async Await (better than Combine 😉)
  • Rewrote app in SwiftUI (and removed all UIKit code). Followed an MVVM-ish architecture. If I spent more time on this project, an architecture cleanup probably would have been my next step.
  • Added "history" of searches using SwiftData.
  • Added a "Personal Note" section where you can add notes about the word you looked up.
  • <4 hour mark was probably around here>
  • Added the Thesaurus API and displayed synonyms for the word.
  • Added an image search API (a random one I found online) and displayed images for the word.

I didn't get to spend as much time on this as I would have liked and I chased the features rather than polishing the app as much as I would have if I were to make an actual PR for this.

TODOS:
Some things I would like to improve:

  • Some of the UI elements could be consolidated into a modifier or something.
  • Navigation could enforce certain stacks (first this page, then that page), which it doesn't right now.
  • I could show the definition UI before/while I load the synonyms and images to make sure the user doesn't get blocked by all 3 API calls before being able to see anything.
  • API could be organized a bit better - definition and thesaurus are kind of related, but the images one is not - I have a fun idea I wanted to try where each API call is an @observable class.
  • I think the Destination cases could not take a WordEntry and I could have the RootView be the one to provide the appropriate data for each view (or maybe extract it out into a "navigation creator" view or something).
  • SwiftData could be updated to have "Preview" values to make previews more consistent. AsyncImage sucks and should be replaced with something better.
  • I have no Error UI / handling and it would be really nice to capitalize on the error support the API provides.
  • Remove searchable and manually put in a TextField at the top cause searchable suuuucks.

Anyway, you get the idea - lots of things I'd love to dive into but I didn't want to go super crazy over time so I called it here.

}

#Preview {
LoadingImage()
Copy link
Author

Choose a reason for hiding this comment

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

This guy was kind of a fun little distraction. I wanted to make the loading spinner be like a sun behind the "default image" image.
Screenshot 2024-09-29 at 11 46 31 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant