Create elegant and intuitive apps that integrate seamlessly with Apple platforms.

Posts under Design tag

70 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

A Swift input method switcher works only after changing focus to another window
-1 I am trying to write a MacOS app which switch input methods by previously assigned shortcut(command+space in here). Switching input methods preoperly works so that the language icon at the status bar(top right) immediately changes as I put the shortcut. The problem I got in here is that the actual input method does not change. For example, if I run my app when the selected input method is Korean, then although the status bar is showing the selected input method is Japanese after command+space, what I can only type is Korean characters. However, after I change focus to another text app(e.g. from sublime text to xcode), only then the selected input method is reflected well. I am using MacOS Monterey 12.6 and Xcode 13.1. My project contains two source files. The code in the file AppDelegate.swift is as follows: import Cocoa @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { var switcher = Switcher() } And the code in the file Switcher.swift is as follows: import Cocoa import MASShortcut class Switcher{ var lang: Int = 0 var kr: TISInputSource? var jp: TISInputSource? var en: TISInputSource? init(){ let inputSourceNSArray = TISCreateInputSourceList(nil, false).takeRetainedValue() as NSArray let inputSourceList = inputSourceNSArray as! [TISInputSource] for inputSource in inputSourceList { if inputSource.id == "com.apple.inputmethod.Korean.2SetKorean" { self.kr = inputSource } if inputSource.id == "com.apple.inputmethod.Kotoeri.RomajiTyping.Japanese" { self.jp = inputSource } if inputSource.id == "com.apple.keylayout.ABC" { self.en = inputSource } } self.register() } func switchLang(){ self.lang = (self.lang + 1) % 3 switch lang { case 0: TISSelectInputSource(self.kr) case 1: TISSelectInputSource(self.jp) case 2: TISSelectInputSource(self.en) default: print("error") } } func register() { let langShortcut = MASShortcut(keyCode: kVK_Space, modifierFlags: [.command]) MASShortcutMonitor.shared()?.register(langShortcut, withAction: { self.switchLang() }) } } I wrote these codes by referring KAWA, but KAWA does not make this issue. I have analyzed all codes of KAWA several times, I couldn't find out why the same problem does not occur in KAWA. I am quite new to Swift, and I have no idea to approach. Could you help me....? Thank you.
0
0
296
Mar ’24
Developing a cosmology app for Vision Pro
Greetings, I'm a new developer and would like to understand exactly how XCode, SwiftUI, Reality Kit, ARKit, Reality Composer Pro and Unity work together to create a cosmology app in 3D? I have created a working solar system using Javascript and html and WebGL for the 3D stuff. I would now like to carry that over to the Apple Vision Pro. Can someone tell me what software frameworks, and api's in the Apple ecosystem I can use to code that? Many thanks
0
0
330
Mar ’24
Detect relaunch of app from launcher in visionOS.
In macOS, there is applicationShouldHandleReopen. Is there an equivalent in visionOS? How would I detect someone tapping on the app icon in visionOS from the Home Screen? Scenario: User opened my app at work and is now home. The open window of the app is spatially elsewhere so clicking on the app icon does nothing. The user can re-center all views, but that ruins the placement of all windows in all apps. When tapping on the app icon, I'd like to be able to launch a new window that can be placed in the new space. Does anyone know how this can be done?
0
0
286
Mar ’24
App rejected because of Guideline 4.3(a) Design
I am building my 2nd React-Native app which is a very simple Notes app. The functionalities are to be able to add, edit & delete notes. And, on the home page where the user can change the orientation of the notes to be in 2 column like a grid or just a list. My app has been getting rejected for Minimal design guideline & I don't know what to do to make it more complex. My first iOS React-Native app was just a single-page Weather app, again that was pretty simple. So, my question is what do I do? OR is the trick that I just keep doing little changes and try to submit & see which one gets accepted??
0
0
377
Mar ’24
4.3.0 Design Spam
Hello, I've a team for developing game in my small company. And we've developed an Obstacle game in Unity from scratch. every single UI, logic & even sound is implemented by our own developers and musicians. It means, every single element is proprietory of our own. I suggest you folks to try out the game in Android playstore by searching the game name as "Cherry Blossom Hills Obstacle" . But once I submitted the same game in iOS App store, the reviewers continously saying, it's a 4.3.0 Design Spam without any to the point feedback basically :( Could you anyone help me resolving this issue? A definitive but even single help/suggestion would be highly appreciated. Regards, Md. Rezoanul Alam.
0
0
500
Feb ’24
Swift TableView: Saving Text from TextField
For the past few months, I’ve been learning about Swift coding. I’m relatively new to the coding field so this may seem trivial to some. Here’s what I’m trying to do: I cannot get the data saved from regular textboxes to appear in the table I've designed on the storyboard. It is clearly saving something to the table rows but I cannot see it. I've looked all over the web but most examples are from old versions of swift/deprecated versions of Xcode and are not applicable. Basically, I’m designing an app for my company that allows quick and easy saving of users that call; I would be able to save their company, name, phone, userid, etc, the app saves it into the table And allows me to reference it later. I'm using core data and I’ve attached all of the code to the appropriate storyboard fields. any insight or errors someone could point out would be very helpful. Here’s my code: import Cocoa import SwiftData import SwiftUI class User: NSManagedObject, Identifiable { let id = UUID() //compatibility @NSManaged public var company: String @NSManaged public var name: String @NSManaged public var phone: String @NSManaged public var uid: String @NSManaged public var cid: String @NSManaged public var tvid: String @NSManaged public var tvpwd: String @NSManaged public var notes: String } class ViewController: NSViewController, NSTableViewDataSource, NSTableViewDelegate { @IBOutlet weak var companyTextField: NSTextField! @IBOutlet weak var nameTextField: NSTextField! @IBOutlet weak var phoneTextField: NSTextField! @IBOutlet weak var uidTextField: NSTextField! @IBOutlet weak var cidTextField: NSTextField! @IBOutlet weak var tvidTextField: NSTextField! @IBOutlet weak var tvpwdTextField: NSTextField! @IBOutlet weak var notesTextField: NSTextField! @IBOutlet weak var tableView: NSTableView! var users = [User]() override func viewDidLoad() { super.viewDidLoad() tableView.dataSource = self tableView.delegate = self } @IBAction func saveButtonClicked(_ sender: NSButton) { let user = User() users.append(user) tableView.reloadData() } // MARK: - NSTableViewDataSource func numberOfRows(in tableView: NSTableView) -> Int { return users.count } // MARK: - NSTableViewDelegate func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { let user = users[row] guard let cell = tableView.makeView(withIdentifier: tableColumn!.identifier, owner: self) as? NSTableCellView else { return nil } switch tableColumn?.identifier.rawValue { case "company": cell.textField?.stringValue = user.company case "name": cell.textField?.stringValue = user.name case "phone": cell.textField?.stringValue = user.phone case "uid": cell.textField?.stringValue = user.uid case "cid": cell.textField?.stringValue = user.cid case "tvid": cell.textField?.stringValue = user.tvid case "tvpwd": cell.textField?.stringValue = user.tvpwd case "notes": cell.textField?.stringValue = user.notes default: return nil } return cell } } ![]
2
0
418
Feb ’24
ButtonView File with AuthenticationFormProtocol: Where to Put in Code?
Hello! This is my first time posting a question on a form. So sorry ahead of time if I am not doing something right and please let me know how I can fix it! I am new to swift and I have been following a video by AppStuff. https://youtu.be/QJHmhLGv-_0?si=OwLGXKNTc3m-UH7r&t=5914 . The link is time stamped to the part of the video I need help with. My question is: Where do I put the AuthenticationFormProtocol var formIsValid so that way I can call on formIsValid to use the .disabled and .opacity in the ButtonView File depending on if formIsValid is true or not? I deviated from the video by making a new file called ButtonView so that way I didn't have to copy and paste code that I would be using in two different places. ButtonView File import SwiftUI struct ButtonView: View { let printTitle: String let title: String let systemIcon: String //@Binding var disabledPlaceHolder: String let taskAction: () -> Void var body: some View { Button(action: { taskAction() }) { HStack { Text(title) .fontWeight(.semibold) Image(systemName: systemIcon) } .foregroundStyle(Color(.white)) .frame(width: UIScreen.main.bounds.width - 32, height: 48) } .background(Color(.systemBlue)) //.disabled(disabledPlaceHolder) //.opacity(disabledPlaceHolder ? 1.0 : 0.5) .clipShape(RoundedRectangle(cornerRadius: 10)) .padding(.bottom, 50) } } #Preview { ButtonView(printTitle: "Sign user up...", title: "Sign Up", systemIcon: "arrow.right", //disabledPlaceHolder: .constant(""), taskAction: {}) } LoginView File import SwiftUI struct LoginView: View { @State private var email = "" @State private var password = "" @EnvironmentObject var viewModel: AuthViewModel var body: some View { NavigationStack { VStack { //image Image("TestLogo") .resizable() .scaledToFill() .frame(width: 100, height: 120) .clipShape(RoundedRectangle(cornerRadius: 20)) .padding(.vertical, 32) //form fields VStack(spacing: 24) { InputView(text: $email, title: "Email", placeholder: "name@example.com") .textInputAutocapitalization(.none) InputView(text: $password, title: "Password", placeholder: "Enter your password", isSecureField: true) } .padding(.horizontal) .padding(.top, 12) //sign in button ButtonView(printTitle: "Login In", title: "SIGN IN", systemIcon: "arrow.right") { Task { try await viewModel.signIn(withEmail: email, password: password) } } // .disabled(formIsValid) // .opacity(formIsValid ? 1.0 : 0.5) Spacer() //signup button NavigationLink { RegistrationView() .navigationBarBackButtonHidden(true) } label: { HStack(spacing: 3) { Text("Don't have an account?") Text("Sign Up") .fontWeight(.bold) } .font(.system(size: 14)) } } } } } extension LoginView: AuthenticationFormProtocol { var formIsValid: Bool { return !email.isEmpty && email.contains("@") && !password.isEmpty && password.count > 5 } } RegistationView File struct RegistrationView: View { @State private var email = "" @State private var fullName = "" @State private var password = "" @State private var confirmPassword = "" @EnvironmentObject var viewModel: AuthViewModel @Environment(\.dismiss) var dismiss var body: some View { VStack { //image Image("TestLogo") .resizable() .scaledToFill() .frame(width: 100, height: 120) .clipShape(RoundedRectangle(cornerRadius: 20)) .padding(.vertical, 32) //form fields VStack(spacing: 24) { InputView(text: $email, title: "Email", placeholder: "name@example.com") .textInputAutocapitalization(.none) InputView(text: $fullName, title: "Full name", placeholder: "Enter your name") InputView(text: $password, title: "Password", placeholder: "Enter your password", isSecureField: true) InputView(text: $confirmPassword, title: "Confirm Password", placeholder: "Confirm your password", isSecureField: true) } .padding(.horizontal) .padding(.top, 12) //sign up button ButtonView(printTitle: "Create User", title: "CREATE USER", systemIcon: "arrow.right") { Task { try await viewModel.createUser(withEmail: email, password: password, fullname: fullName) } } // .disabled(formIsValid) // .opacity(formIsValid ? 1.0 : 0.5) Spacer() Button { dismiss() } label: { HStack(spacing: 3) { Text("Already have an account?") Text("Sign In") .fontWeight(.bold) } .font(.system(size: 14)) } } } } extension RegistrationView: AuthenticationFormProtocol { var formIsValid: Bool { return !email.isEmpty && email.contains("@") && !password.isEmpty && password.count > 5 && confirmPassword == password && !fullName.isEmpty } }
1
0
316
Feb ’24
In Real Time Panoramic View on Apple Vision Pro
I've seen videos on how people on Youtube are using the Apple Vision pro as a Camera Monitor. I found this very neat, but I was wondering if there is a way to make a live stream panoramic view of live CCTV footage, with the Apple Vision Pro. SO my question is, can you make a panoramic view of something that is live, in real time?
2
0
471
Feb ’24
How to Change Picker Text Color In SwiftUI
I try to change picker text color but, it does not work. As you see, "City" and "District"'s color are blue but, I'd like to make them white. I have tried below codes but, they do not work. Do you know any methods for that ? Picker("İl", selection: $selectedCity) { ForEach(turkishCities, id: \.self) { city in Text(city) .foregroundColor(.white) } } Picker("İlçe", selection: $selectedDistrict) { ForEach(cityDistricts[selectedCity] ?? [], id: \.self) { district in Text(district) .foregroundColor(Color.white) } } .onAppear { UISegmentedControl.appearance().setTitleTextAttributes([.foregroundColor: UIColor.white], for: .normal) } Thank you in advance.
2
0
3.2k
Feb ’24
Using a varirable for padding parameter
I'm looking to use a variable for the padding parameters but always seem to get an error reading "No exact matches in call to instance method 'padding'" ForEach(allGames) { theGame in var the_pad: [Edge.Set] = [.horizontal] if theGame.name == "Game1" { var the_pad: [Edge.Set] = [.horizontal,.top] } HStack{ ... } .padding(the_pad) } This is the code without all the stuff in HStack (which has no problems), to keep it simple This is for a menu and the top item gets cut off at the top hence it needs padding but the other menu items have better spacing without it. Yes, I got it to work using an if-else statement and 2 different HStacks, but I'm trying to learn and I'm wondering what I'm doing wrong.
0
0
270
Feb ’24
Guideline 1.5 - Safety - Developer Information The support URL specified in your app’s metadata, https://www.doclinkapp.net/privacypolicy, does not properly navigate to the intended destination.
Hi, I uploaded my app to the app store but Apple rejected it and gave me the following reason for rejection. I don't know how to fix it because url for policy of privacy is working and show information. Please guide me for this how can I resolve it and re upload my app. Thank You Guideline 1.5 - Safety - Developer Information The support URL specified in your app’s metadata, https://www.doclinkapp.net/privacypolicy, does not properly navigate to the intended destination. Next Steps To resolve this issue, please revise your app’s support URL to ensure it directs users to a webpage with support information.
1
0
569
Feb ’24
Who will build first app that I can use while I sleep (quite literally)(24/7 immersion)?
In theory, sending signals from iPhone apps to and from the brain with non-invasive technology could be achieved through a combination of brain-computer interface (BCI) technologies, machine learning algorithms, and mobile app development. Brain-Computer Interface (BCI): BCI technology can be used to record brain signals and translate them into commands that can be understood by a computer or a mobile device. Non-invasive BCIs, such as electroencephalography (EEG), can track brain activity using sensors placed on or near the head[6]. For instance, a portable, non-invasive, mind-reading AI developed by UTS uses an AI model called DeWave to translate EEG signals into words and sentences[3]. Machine Learning Algorithms: Machine learning algorithms can be used to analyze and interpret the brain signals recorded by the BCI. These algorithms can learn from large quantities of EEG data to translate brain signals into specific commands[3]. Mobile App Development: A mobile app can be developed to receive these commands and perform specific actions on the iPhone. The app could also potentially send signals back to the brain using technologies like transcranial magnetic stimulation (TMS), which can deliver information to the brain[5]. However, it's important to note that while this technology is theoretically possible, it's still in the early stages of development and faces significant technical and ethical challenges. Current non-invasive BCIs do not have the same level of fidelity as invasive devices, and the practical application of these systems is still limited[1][3]. Furthermore, ethical considerations around privacy, consent, and the potential for misuse of this technology must also be addressed[13]. Sources [1] You can now use your iPhone with your brain after a major breakthrough | Semafor https://www.semafor.com/article/11/01/2022/you-can-now-use-your-iphone-with-your-brain [2] ! Are You A Robot? https://www.sciencedirect.com/science/article/pii/S1110866515000237 [3] Portable, non-invasive, mind-reading AI turns thoughts into text https://techxplore.com/news/2023-12-portable-non-invasive-mind-reading-ai-thoughts.html [4] Elon Musk's Neuralink implants brain chip in first human https://www.reuters.com/technology/neuralink-implants-brain-chip-first-human-musk-says-2024-01-29/ [5] BrainNet: A Multi-Person Brain-to-Brain Interface for Direct Collaboration Between Brains - Scientific Reports https://www.nature.com/articles/s41598-019-41895-7 [6] Brain-computer interfaces and the future of user engagement https://www.fastcompany.com/90802262/brain-computer-interfaces-and-the-future-of-user-engagement [7] Mobile App + Wearable For Neurostimulation - Accion Labs https://www.accionlabs.com/mobile-app-wearable-for-neurostimulation [8] Signal Generation, Acquisition, and Processing in Brain Machine Interfaces: A Unified Review https://www.frontiersin.org/articles/10.3389/fnins.2021.728178/full [9] Mind-reading technology has arrived https://www.vox.com/future-perfect/2023/5/4/23708162/neurotechnology-mind-reading-brain-neuralink-brain-computer-interface [10] Synchron Brain Implant - Breakthrough Allows You to Control Your iPhone With Your Mind - Grit Daily News https://gritdaily.com/synchron-brain-implant-controls-tech-with-the-mind/ [11] Mind uploading - Wikipedia https://en.wikipedia.org/wiki/Mind_uploading [12] BirgerMind - Express your thoughts loudly https://birgermind.com [13] Elon Musk wants to merge humans with AI. How many brains will be damaged along the way? https://www.vox.com/future-perfect/23899981/elon-musk-ai-neuralink-brain-computer-interface [14] Models of communication and control for brain networks: distinctions, convergence, and future outlook https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7655113/ [15] Mind Control for the Masses—No Implant Needed https://www.wired.com/story/nextmind-noninvasive-brain-computer-interface/ [16] Elon Musk unveils Neuralink’s plans for brain-reading ‘threads’ and a robot to insert them https://www.theverge.com/2019/7/16/20697123/elon-musk-neuralink-brain-reading-thread-robot [17] Essa and Kotte https://arxiv.org/pdf/2201.04229.pdf [18] Synchron's Brain Implant Breakthrough Lets Users Control iPhones And iPads With Their Mind https://hothardware.com/news/brain-implant-breakthrough-lets-you-control-ipad-with-your-mind [19] An Apple Watch for Your Brain https://www.thedeload.com/p/an-apple-watch-for-your-brain [20] Toward an information theoretical description of communication in brain networks https://direct.mit.edu/netn/article/5/3/646/97541/Toward-an-information-theoretical-description-of [21] A soft, wearable brain–machine interface https://news.ycombinator.com/item?id=28447778 [22] Portable neurofeedback App https://www.psychosomatik.com/en/portable-neurofeedback-app/ [23] Intro to Brain Computer Interface http://learn.neurotechedu.com/introtobci/
0
1
604
Feb ’24
Creating a SideBar for visionOS.
Hi! I am working on an app for Vision Pro. I would like to create a SideBar in a view that shows different topics, that you can click on. Firstly, I need help understanding how to create a SideBar. Also, I have already made the different topics that will be displayed on the SideBar but I don't know how to link the SideBar up to the topics view. For example, if a user clicks on Maple Trees as a topic in the SideBar, it would take them to a new window that talks about Maple Trees. If you can help, that would be great!
0
0
419
Jan ’24