Explore the art and science of app design. Discuss user interface (UI) design principles, user experience (UX) best practices, and share design resources and inspiration.

All subtopics

Post

Replies

Boosts

Views

Activity

Most efficient way to call a function upon variable state change
Hi, I have a button view that is used in many different ways in an app that I'm working on. One of the ways it is used is in an account creation form. Since the button is in a child view, the action: { } button function isn't available in the view where the input field variables are. I could import the class with the function to the button view but I don't want to pass the input field variables into the button view. I tried binding a boolean variable to the button view and checked for it's state change in the parent view using .onChange(), but the use case for that I found was depreciated and I'm unable to revert the state of the variable in the .onChange function. To reiterate, in a main view, I need to call a function in a given class and pass variables to it, upon a button being pressed in a child view. Any help would be greatly appreciated.
1
0
88
1d
PiPAgent not launching from a Sandboxed app.
Hi, I am developing an app that has a WKWebView and it can open sites like Youtube. The app is sandboxed as it is meant to be uploaded to the mac App Store. It has a feature PiP where we start the native PiP by calling a browser Javascript where we tell the WKWEBView to fire the PiP. It works well when we are running the code from XCODE in Debug scheme. When we run the code from release mode by archiving it or directly from the build folder, the WKWebView is not able to fire the PiP Agent and thus the Native PiP window is not visible, while the site shows that PiP is opened and we can here the sound being played. But PiP window is not visible. I cannot see PiPAgent in activity monitor. Why does it not work from within the release build outside xcode. But when I try to run the build directly from the Finder in builds folder, this PiP feature does not work. Request technical help for this. Thanks!
0
0
76
2d
What is the secret to good UI?
Hello, I’m an aspiring full stack dev and I’m just wondering how the heck you get good UI AND UX. I’m currently moodboarding and seeing how things look in FigJam and then taking that and coding in Swift. I am struggling and my sanity is hanging on by a string 😂. So tell me, how do you get good UI and UX?
2
1
132
2d
UICollectionView
I have 12 cells in a collection view. I am trying to find Swift code to make it display (4 rows x 3 columns) when the device is portrait, and then (2 rows by 6 columns) when in landscape. I need each cell to evenly layout within the view and to fill it.
0
0
88
3d
Lock Screen Orientation
Looking for code to prevent a user from going landscape on a particular view controller only for an iPhone. The user should be able to rotate the view to landscape on an iPad only on the view controller.
0
0
84
3d
Homescreen without app names
Please, add option to remove app names but keep smaller icons on homescreen. Just like in the dock. You can just add option "no title" beside small and large option in homescreen customize section
1
0
137
5d
Suggestion for new app icon tints
I feel like with the option to have many custom wallpapers that you can select from and create, we should be able to have a way of creating a preset for the icon tint color along with the wallpaper. For example, If i have one wallpaper that is orange, and i make the icons match that and make them orange tinted, and later make another wallpaper preset with a green wallpaper with green icon tints. When i switch wallpapers, the icon color tint that was set with that wallpaper should appear (orange background w/ orange tint or green background w/ green tint). As of right now, if I set the app icons tint, and change the wallpaper, the app icons tint stays the same as it was with the other background, and becomes mismatched in a way (orange background with green icons when i had set orange icons).
1
0
280
6d
iOS dark mode app icon
the application icon turns black in iOS 18's dark mode, resembling a ghost. Therefore, we would like to understand how Apple processes the background of app icons to turn them black in dark mode. My request is as follows: I would like to understand the color change principle of app icons in dark mode. Without using Xcode 16, how can we ensure compatibility so that users with iOS 18 can see the normal icon?
0
0
309
1w
Different mute indicators for CarPlay and iPhone
Is there a reason why the active mute indicator is different between CarPlay and iPhone? The iPhone active mute indicator is a button with a white background and a red icon whereas the CarPlay active mute indicator is a button with a white background and black icon. We make a CallKit app that supports CarPlay and that's how this was noticed, however the Apple phone app behaves the same. I suspect this is intentional as to cut down on distractions for drivers. Any further explanation would be appreciated. Thanks
0
0
231
1w
64-bit Apple Watches with 64-bit pointer sizes?
I have a watchOS app written in C++, Swift and SwiftUI. This app is meant only for 64-bit architecture. I know Apple uses the arm architecture, so I thought arm64 will be the arch of latest AppleWatches. I tested my code in x64 simulator (Intel Mac) and arm64 simulator (silicon Mac) - no trouble. Next is to test on a device - AppleWatch Series 9, model: A2984. I set the arch to arm64 and my application failed to build, with Xcode showing a popup about arch mismatch... which is due to the app's arch begin different from device's arch. When I change Xcode arch setting to arm64_32, then I don't get this popup, but my builds fail. When I read about arm64_32, I realised that this is a version of arm64 with 32 bit pointers... not the arm64 with 64 bit pointers. Looking at the specification of AppleWatch Series 9, Apple has confirmed that it has 64 bit CPU, but the instruction set is unknown. This wiki page about different AppleWatch CPUs is marked TBC for AppleWatch Series 9. From Xcode, I got to know that this unconfirmed arch is arm64_32. This completely breaks my code. Are there any 64-bit watches with 64-bit pointer sizes? What is Apple's future in this area? Do they plan to release AppleWatches that support 64-bit pointers or it's always going to be 32?
1
0
305
1w
SwiftUI design elements
Hello everyone, for a personal project I'd like to reproduce a design element from Apple's saving application. I'd like to display three rectangles containing text: two horizontally aligned and one next to it. And I'd like the height of the last rectangle to be equal to the height of the two smallest. Does anyone have a solution? Please provide a sample code
4
0
238
1w
new developer, need help displaying on screen
brand new newbie developer to xcode. so im doing an api call and getting back data from a mysql database. in the xcode preview window im getting data, but i cant figure out how to tie it to the screen when going into the simulator. i have screen 1 that i want to click a button to go to screen 2 that displays the data. screen one (home screen) comes up okay. cant quite figure out what im doing wrong here. im thinking its either a class issue or something to do with view or something. not sure. ive tried looking at so many different videos and i cant seem to find my answer. Any help would be appreciated. thank you View Controller: import UIKit //import SwiftUI let URL_TOURNAMENT_FETCH = "https://www.thesoftball.com/t2g_mobile_app/mobile_api.php" class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() } @IBAction func onEmailButtonPressed(_ sender: Any) { UIApplication.shared.open(URL(string: "mailto:[email]")! as URL, options: [:],completionHandler: nil) } /* @IBAction func FetchTournButton(_ sender: Any) { UIApplication.shared.open(URL(string: "https://www.thesoftball.com/t2g_mobile_app/mobile_api.php")! as URL, options: [:],completionHandler: nil) } */ @IBAction func ViewTournamentButton(_ sender: Any) { // the following is a popup let alertController = UIAlertController(title: "Welcome to My First App", message: "Hello World", preferredStyle: UIAlertController.Style.alert) alertController.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil)) present(alertController, animated: true, completion: nil) } @IBAction func account_button_pressed(_ sender: Any) { UIApplication.shared.open(URL(string: "https://www.thesoftball.com")! as URL, options: [:],completionHandler: nil) } /* struct viewDidLoadModifier: viewDidLoadModifier { @State private var didLoad = false private let action: (() -> void)? init(perform action) { } } */ } ContentView (preview works in this) import SwiftUI struct ContentView: View { @StateObject var viewModel = ViewModel() var body: some View { NavigationView{ List{ ForEach(viewModel.courses,id: \.self) { tournament in HStack { Image("") .frame(width: 5, height: 120) .background(Color.orange) VStack { Text(tournament.name).bold() Text(tournament.dates) Text(tournament.datee) Text(tournament.location) // Text(course.location) // Text(course.message) // .bold() } } .padding(0) } } .navigationTitle("Tournaments") // .onAppear { viewModel.fetch()} .onAppear(perform: viewModel.fetch) } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }
0
0
175
1w
How to animate NavigationSplitView's detailView column.
Having a traditional 'NavigationSplitView' setup, I am looking for a way to animate it the same as the sidebarView, where there is a button to toggle and it animates by sliding out from the right side of the view, however the closest I have gotten was manipulating the 'navigationSplitViewColumnWidth' but that always results in the view instantly appearing / disappearing. I am using SwiftUI for a MacOS specific app. Here is just a general idea of what I am currently doing, it is by no means a reflection of my real code but serves the purpose of this example. struct ContentView: View { @State private var columnWidth: CGFloat = 300 var body: some View { NavigationSplitView { List { NavigationLink(destination: DetailView(item: "Item 1")) { Text("Item 1") } NavigationLink(destination: DetailView(item: "Item 2")) { Text("Item 2") } NavigationLink(destination: DetailView(item: "Item 3")) { Text("Item 3") } } .navigationTitle("Items") } detail: { VStack { DetailView(item: "Select an item") Button(action: toggleColumnWidth) { Text(columnWidth == 300 ? "Collapse" : "Expand") } .padding() } } .navigationSplitViewColumnWidth(columnWidth) } private func toggleColumnWidth() { withAnimation { columnWidth = columnWidth == 300 ? 0 : 300 } } } struct DetailView: View { var item: String var body: some View { Text("Detail view for \(item)") .navigationTitle(item) .padding() } } @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } }
1
0
330
3w
code object is not signed at all In subcomponent ...
I'm a newbie in Mac development and Xcode. Trying to revive an old cross-platform open source project of mine and to continue its development on Xcode. A new project setup was created using CMake. Managed to compile the project with the required dependencies outside Xcode. If I try to build the project in Xcode, the only error is: Command CodeSign failed with a nonzero exit code Details: ... zzzz.app code object is not signed at all in subcomponent ... Found a similar question in this forum: https://forums.developer.apple.com/forums/thread/701261 Tried to follow the recommendations there, but without success. The subcomponent in question is simply text files (xpm) which are used by the application during runtime, and are supposed to be copied in the app/Contents directory Will appreciate any help Further details on the setup: (Signing and Capabilities): Signing is automatic; Team: "None"; Bundle identifier: empty Signing certificate: "Sign to run Locally" (Build phases): Tried to check "Code Sign on Co..." - no difference If I check "Copy only when installing" - it builds fine, yet it is not copying my resource files in my zzzz.app/Contents directory Xcode Version 15.3 (15E204a) The project is in GitHub
0
0
307
3w