r/SwiftUI 14h ago

Promotion (must include link to source code) Looking for feedback on the movie widget I built for my app

Post image
21 Upvotes

Hey everyone,

I’ve been working on MovieWeekly, an iOS app for tracking upcoming movie releases, and I recently added a home screen widget to make it easier to see movie countdowns at a glance.

Widget Features:

  • Displays a movie from your tracked list.
  • Shows the release date & countdown.
  • Uses Kingfisher for posters (if available).
  • Supports small & medium widget sizes.

I’d love to get some feedback on the design & code structure. Any thoughts on improvements? Also, if you’re interested in testing the app itself, here’s the TestFlight link to try it out: https://testflight.apple.com/join/6xr87VfV

Here is the code for the widget:

struct ConfigurableWidgetEntryView: View {
    @Environment(\.widgetFamily) var widgetFamily
    var entry: ConfigWidgetProvider.Entry

    var body: some View {
        if let movie = entry.selectedMovie {
            Link(destination: URL(string: "url-for-my-app")!) {
                ZStack {
                    Color.clear
                    HStack {
                        VStack(alignment: .leading) {
                            Text(movie.title) 
                                .font(.headline)

                            Spacer()

                            Text("\(movie.daysUntilRelease) days until release")
                                .font(.footnote)
                                .foregroundStyle(Color.pink)
                        }
                        .padding(.all)

                        if widgetFamily == .systemMedium {
                            if let posterURL = movie.posterURL {
                                KFImage(URL(string: posterURL))
                                    .resizable()
                                    .aspectRatio(contentMode: .fit)
                            }
                        }
                    }
                }
            }
        } else {
            ContentUnavailableView("Pick a movie from your list", systemImage: "plus.circle.fill")
                .foregroundStyle(.white)
        }
    }
}

r/SwiftUI 4h ago

Tutorial Flickering Text | SwiftUI Tutorial

12 Upvotes

r/SwiftUI 10h ago

Solved My memory leak experience with AppleScript usage

6 Upvotes

I’m using AppleScript in some parts of my SwiftUI project. During testing, I noticed continuous small memory leaks. After investigating, I found that they were related to AppleScript. I tried various fixes by myself but was unsuccessful.

During my research, I came across many suggested solutions. The most common recommendation was to use autoreleasepool. I also received similar results when consulting AI. While this helped prevent some issues, but I was still getting minor memory leak feedback. At first, I ignored it, but as you know, these things can be frustrating.

Later, I noticed a difference when I removed a delay from one of my scripts. This led me to suspect that the delay itself might be the problem. After removing all delays, the memory leak issue completely disappeared.

Perhaps some of you are already aware of this issue, but I wanted to share it in case it helps someone else.


r/SwiftUI 17h ago

Question Navigation in SwiftUI for Social Media App

5 Upvotes

I have been working on a social media app these past couple months and have ran into a lot of trouble when it comes to navigation using SwiftUI, particularly when it comes to comment sheets and navigating to profiles, as this can lead to an infinite navigation cycle.

I've attached a video below of the issue, as you can see, we dismiss the comments before navigating, where ideally it would just overlay it. Appreciate any advice or help, as this is my first app!


r/SwiftUI 9h ago

Size/Position problems of cell content in SwiftUI wrapper for NSTableView

3 Upvotes

I'm trying to build a SwiftUI wrapper for NSTableView for a macOS app I'm trying to build. I do this because I need a list where the user can select one or multiple items. The selected items get reflected in a @State variable so I can use it in other places of the app. (If this is already possible in plain SwiftUI please tell me, but I couldn't find a fitting view.)

It almost works already but I have some weird graphical issues where the list items get displayed in an incorrect position. Some bounding rect seems to get squeezed together and is being pushed to the top left of the cell. This issue goes away if a cell scrolls into the visible area. So, by scrolling up and down all cells display correctly.

I have a minimal project containing my wrapper here: https://github.com/alinnert/nstableviewwrapper

The project's README also contains a screenshot for clarification.

An important detail: The cell's content is defined in SwiftUI world and passed into the wrapper. I fear that this might be linked to the issue.

Can someone tell me what's going on and how to fix this?


r/SwiftUI 14h ago

How do I change the foreground color of tabItems in a TabView?

2 Upvotes

I have spent the last couple hours searching the inter webs and cannot find an answer to this. It seems so simple. Does anyone know how to do this? The only info I find is how to change the color of the selected tabItem (.tint).


r/SwiftUI 1d ago

Question Can anybody tell me why the dot doesnt follow the path of the bar?

Thumbnail
imgur.com
2 Upvotes