Posts

Post marked as unsolved
469 Views

Obtain / reset a "3rd Party Mac Developer Installer" certificate

Upon trying to upload a new build to App Connect, which worked fine four weeks ago, validate gives an error that: The product archive package's signature is invalid. Ensure that it is signed with your "3rd Party Mac Developer Installer" certificate. Uploading gives the same error: ERROR ITMS-90237: "The product archive package's signature is invalid. Ensure that it is signed with your "3rd Party Mac Developer Installer" certificate." This is despite updating in my developer profile and downloading the new "3rd Party Mac Developer Installer" certificate, which shows up as valid in my keychain. So confused...
Asked
by wingover.
Last updated .
Post marked as unsolved
204 Views

Icons in sidebar toolbar for MacOS SwiftUI app

In a collapsible sidebar's toolbar area, I'd like to have icons available when it is open... similar to Xcode and many apps. However, every SwiftUI .toolbar positioning parameter I've tried only affects the main toolbar. Any tips? Bonus: positioning the sidebar open/close button inside the sidebar toolbar when open and moving it to the main toolbar's leftmost side when not.
Asked
by wingover.
Last updated .
Post marked as solved
165 Views

Parameter update from NSView (right click in MacOS SwiftUI)

While function calls work as expected in an NSViewRepresentable, I'm unclear why the parameter passed below (to show a SwiftUI popup) does not update after a function call in the NSView. Any tips? Some View Struct @State var showMenu = false var body: some View { 	 ZStack { 	 RightClickableSwiftUIView(onClick: $showMenu) 	 Image(name) 	 .popover(isPresented: $showMenu, ...) 	 } } RightClick.swift import SwiftUI struct RightClickableSwiftUIView: NSViewRepresentable { 		@Binding var onClick: Bool 		func updateNSView(_ nsView: RightClickableView, context: NSViewRepresentableContext<RightClickableSwiftUIView>) { 		} 		func makeNSView(context: Context) -> RightClickableView { 				RightClickableView(onClick: $onClick) 		} 		class RightClickableView : NSView { 				required init?(coder: NSCoder) { 						fatalError("init(coder:) has not been implemented") 				} 				init(onClick: Binding<Bool>) { 						_onClick = onClick 						super.init(frame: NSRect()) 				} 				@Binding var onClick: Bool 				override func mouseDown(with theEvent: NSEvent) { 						print("left mouse") 				} 				override func rightMouseDown(with theEvent: NSEvent) { 						onClick = true 						print("right mouse") 				} 		} } This is related to another user's post: https://developer.apple.com/forums/thread/127921
Asked
by wingover.
Last updated .
Post marked as unsolved
237 Views

Buggy look of SwiftUI CommandMenu Buttons

Images cannot be linked here, but the code below produces buttons that are inset differently than all auto-generated MacOS buttons. Keyboard modifiers are white, rather than gray. Dividers also don't work properly, nor accept color changes, nor it is reliable to sort in a Rectangle. Spacer() is selectable, but at least an empty Text("") is not. Why? struct AppMenus: Commands { 		func some() {} 		@CommandsBuilder 		var body: some Commands { 				CommandMenu("Why") { 						Button("So") { some() } 								.keyboardShortcut( KeyEquivalent("s"), modifiers: .command) 						Text(" ") Spacer() Divider() .foregroundColor(Color(.doesntCare)) 						Button("Sad") { some() } 								.keyboardShortcut( KeyEquivalent("s"), modifiers: .command) } 				CommandGroup(before: CommandGroupPlacement.sidebar) { 						Button("Why my button so sad?") {} 								.keyboardShortcut(KeyEquivalent("?"), modifiers: .command) 				} 		} }
Asked
by wingover.
Last updated .
Post marked as unsolved
142 Views

MacOS SwiftUI Menu action for function after App struct instantiated

Storyboard menus connect to functions anywhere. SwiftUI menus can access functions in view models instantiated in the App struct, but not anything later because .commands only returns a Scene. Is that a missing feature or am I missing something?
Asked
by wingover.
Last updated .
Post marked as unsolved
177 Views

How to return image from QLThumbnailGenerator

My ProblemHow do I return a cgImage from QLThumbnailGenerator.shared.generateRepresentations(for: ... )?My Hangups/Attempt (Code Below)My attempt has a function (line 13) that returns a CGImage for a ListView entry (line 39). I tried to use an empty CGImage (line 18), but its init parameters are confusing and seem excessive for a simple thumbnail. I'm likely going about this incorrectly.NotesCGImage is used so the same code can work for both iOS and MacOS Catalyst. (Saw this in WWDC 2019 session 719.)I tried but failed to glean an answer from: https://developer.apple.com/documentation/quicklookthumbnailing/creating_quick_look_thumbnails_to_preview_files_in_your_apphttps://forums.developer.apple.com/message/375807App overview: This is a public service app that searches a specified library of PDFs for an array of terms for misidentified biomaterials, helping biologists screen for potentially false results in every paper they've read. It will be free.Apology/Gratitude:Thanks for your patience, as the answer is likely obvious and my vocabulary likely off. My dumb brain tunes out lectures without a little hands-on experience, so I started this first app from zero programming knowledge as a quarantine hobby. I'll return to the theory lectures after.Code: ResultsView.swiftimport SwiftUI import MobileCoreServices import Combine import QuickLookThumbnailing import CoreImage import UIKit struct ResultsView: View { @EnvironmentObject var parsedScreeningData: ParsedScreeningData @EnvironmentObject var search: Search func generateThumbnail(ofThis: String) -> CGImage { let url = self.search.libraryFolder.appendingPathComponent(ofThis) let size: CGSize = CGSize(width: 68, height: 88) let request = QLThumbnailGenerator.Request(fileAt: url, size: size, scale: (UIScreen.main.scale), representationTypes: .all) let generator = QLThumbnailGenerator.shared var image = CGImage() generator.generateRepresentations(for: request) { (thumbnail, type, error) in DispatchQueue.main.async { if thumbnail == nil || error != nil { assert(false, "Thumbnail failed to generate") } else { image = thumbnail!.cgImage } } } return image } var body: some View { VStack{ List(search.searchResults) { datum in HStack { Image(self.generateThumbnail(ofThis: datum.PDFname), scale: (UIScreen.main.scale), label: Text("PDF")) Text("File: \(datum.PDFname)") Text("Cell line: \(self.parsedScreeningData.parsedScreeningData[datum.termFoundIndex].misidentifiedCellLine)") .padding(.trailing, 10) .padding(.leading, 10) Spacer() Image(systemName: "eyeglasses").foregroundColor(ColorManager.iconGreen) // .onTapGesture { // let url = URL.init(string: "\(datum.termFoundIndex)") // guard let thisAddress = url, UIApplication.shared.canOpenURL(thisAddress) else { return } // UIApplication.shared.open(thisAddress) } // HStack } // List }// Vstack .colorMultiply(ColorManager.beigeMedium) .padding(.trailing, 0) .padding(.leading, 0) .listStyle(GroupedListStyle()) } // body } // ResultsView struct struct ResultsView_Previews: PreviewProvider { static var previews: some View { ResultsView().environmentObject(ParsedScreeningData()).environmentObject(Search()) } }
Asked
by wingover.
Last updated .
Post marked as unsolved
144 Views

Pushed view temporarily displays hidden navBar/Back

The pushed view temporarily renders its contents with space for the hidden navigationBar immediately upon transition. How do I fix this behavior?Barebones demo:ContentView.swiftimport SwiftUI struct ContentView: View { @State var goToNextView = false var body: some View { NavigationView { ZStack { Color.yellow.edgesIgnoringSafeArea(.all) NavigationLink(destination: SecondView(), isActive: $goToNextView) {Text("")} .navigationBarTitle("") .navigationBarHidden(true) .navigationBarBackButtonHidden(true) VStack { Button(action: { print("Button clicked") self.goToNextView = true }) { Text("Go to second view") } .padding() Text("This is the first view.") } } .foregroundColor(Color.blue) } } }SecondView.swiftimport SwiftUI struct SecondView: View { var body: some View { ZStack { Color.purple .edgesIgnoringSafeArea(.all) .navigationBarBackButtonHidden(true) .navigationBarHidden(true) Text("Pushed view") } .foregroundColor(Color.white) } }
Asked
by wingover.
Last updated .