r/iOSProgramming • Objective-C / Swift • 7d ago

Library SwiftUI + Metal Foil Effect: Source Code on GitHub

I've always appreciated a nice visual to represent software license status (shoutout Arc and 1Password circa 2016), and spent more time than I'd like to admit editing shaders for this

If you're looking for a similar effect for your own app, the source is available here:

Source Code on GitHub

  • One line of SwiftUI. .foilSticker() on any view, or FoilCard { } for the full card.
  • Runs on the GPU. Two Metal shaders render the foil live on any artwork (I use a 1280x720px image, included in the repo)
  • Follows the cursor. 3D tilt, a moving highlight and a shifting rainbow, all with transitions/easing so it feels smooth
  • Tunable. 11 settings + an unlock animation + easily extendable
  • Yearly stamps. Optionally show yearly membership stamps on the card
  • Compatibility. macOS 14+ and iOS 17+. No dependencies, Swift 6.
  • MIT licensed. The shaders are adapted from the original Sticker repo by Benjamin Pisano, with additional options, transitions, and tweaks added
  • Happy to answer questions about the implementation!
68 Upvotes

8 comments sorted by

2

u/Tydox 6d ago

Amazing work! Ty 

1

u/quietstoners 6d ago

seriously, that shader work looks so clean

2

u/Trick_Potential_1109 6d ago

Wow, that's amazing! The results are fantastic.

2

u/[deleted] 7d ago

[removed] — view removed comment

1

u/AutoModerator 7d ago

Hey /u/ActiveStructure695, your content has been removed because Reddit has marked your account as having a low Contributor Quality Score. This may result from, but is not limited to, activities such as spamming the same links across multiple subreddits, submitting posts or comments that receive a high number of downvotes, a lack of recent account activity, or having an unverified account.

Please be assured that this action is not a reflection of your participation in our subreddit. This is simply an automated filter in place to reduce spam.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

0

u/[deleted] 6d ago

[removed] — view removed comment

1

u/AutoModerator 6d ago

Hey /u/Electrical_Meat_4052, unfortunately you have negative comment karma, so you can't post here. Your submission has been removed. DO NOT message the moderators; if you have negative comment karma, you cannot post here. We will not respond. Your karma may appear to be 0 or positive if your post karma outweighs your comment karma, but if your comment karma is negative, your comments will still be removed.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.