SwiftUI App: How to hide title bar for macOS app? - ios

This is NOT a MacCatalyst app or SwiftUI macOS app. But an iOS app with macOS target(As shown below). I'm trying to hide the title bar of the macOS app in this setting.
.windowStyle(HiddenTitleBarWindowStyle()) will not work because
this is not a traditional macOS app. Thus, the API is not available.
titlebar.titleVisibility = .hidden will not work because this is
not a catalyst app. In addition, sceneDelegate does not exist in
SwiftUI lifecycle.
I'm trying to look for a solution that works for the case of above screenshot. An iOS app with macOS 11+ as deployment target.
Some user points out that this is a MacCatalyst app. And I had closed the previous question. But after some testing, I can confirm this is indeed NOT MacCatalyst. It's a new way of running iOS app on Mac that is only available on Apple Silicon Mac. MacCatalyst target refers to the Rosetta approach only.
As shown on image below. My question is about hiding status bar on My Mac(Designed for iPad)
Testing code as below. MacCatalyst code only gets called on target Mac(Rosetta)
New API related to my problem is ProcessInfo.processInfo.isiOSAppOnMac. I'm wondering how to hide title in this particular case.

Related

Can the default tvOS controller support also be used for the iOS and macOS version of an app/game?

I developed a small game for iOS, macOS and tvOS and just discovered that the tvOS version automatically supports for example the DualShock controller as it basically just uses the same inputs as on the Siri remote. (Moving left/right/up/down and pressing a button for selection) It's already pretty nice that this works just out of the box, but I was wondering, if this behaviour can also be mapped to the iOS/macOS version? Something like GCController -> Use the navigation of tvOS's focus engine.

ThemePicker in iOS Scrumdinger tutorial not displaying ThemeView colors

I looked through the completed version of this lesson, and it also does not show the background color. I'm wondering if this has to do with different versions of Swift/XCode
Expected view
Actual view in project
This is how Picker styled in iOS16 you can try on iOS 15 simulator and see the expected view.
In Xcode 14.1.3 beta iO16 added NavigationLinkPickerStyle which has the pre iOS 16 behavior.
You can see detailed answer from here
https://stackoverflow.com/a/73897344/1000846
If you use the latest version of iOS, in the ThemePicker file you can try to chose picker style. This is how it will looks in iOS 16.2
var body: some View {
Picker("Theme", selection: $selection){
ForEach(Theme.allCases) { theme in
ThemeView(theme: theme)
.tag(theme)
}
}
.pickerStyle(.navigationLink)
I've been facing this issue too. It seems that the API for Picker has changed in iOS 16.
For the sake for working though the tutorial and learning Swift I got past this by installing an older version of iOS. Once I work though the tutorial I can figure out how to upgrade my code to work with iOS 16.
Go to Window -> Devices and Simulators and install iOS 15.5.
After you have installed iOS 15.5 you'll need to change your "Minimum Deployments" to iOS 15.5 in your project file.
After setting your minimum deployment target to iOS 15.5 you can then select an iOS 15.5 device in Product -> Destination -> iPhone 13 Pro (15.5).
The tutorial should now work as expected in both the Swift UI Previews in Xcode as well as your device simulator.

iOS 8 keyboard extension only loading on iPhone 5 and 5s

I am currently working on a keyboard extension for iOS 8. Until recently, I was testing the extension exclusively on the iPhone 5 simulator. Upon switching the simulator to the iPhone 6(both simulator and physical phone), 6 Plus, and 4s and clicking on a text field, the keyboard doesn't appear at all. No error is shown either. Thinking that this was a bug in my program, I tested a new program that just had the default code, and the same thing happened. I am using the latest OS X, Xcode, and IOS Simulators.
There is a known issue with 8.1 that causes keyboards to not display in simulator.
Keyboards Known Issue
Additional Keyboards, including 3rd party keyboards, may not appear in
Safari, Maps or 3rd party apps on the Simulator.
Workaround: Keyboards should be testable in Calendar, Spotlight,
Contacts, and Photos.
I interpret this to mean your enclosing app won't work either. My keyboard won't display in Safari or Maps, but works fine in Photos search bar.
You have to clean the project EVERYTIME you change something in the code of an application linked to an App Extension on Xcode 6.1 (Acknowledged bug in Xcode 6.1 release notes)

My empty swift app crashes on xcode6-beta with deployment target 7.1

My objective is to verify that swift apps/code can run on iOS 7 simulators
I am following this question Do Swift-based applications work on OS X 10.9/iOS 7 and lower?
and specifically this answer -by #Anil https://stackoverflow.com/a/24038997
The following are the steps I followed
Installed xcode6 beta
Installed iOS 7.1 simulator from Xcode6->Preferences->Downloads
Now, I created a new iOS Application Master Detail project and selected swift as language
With default settings I was able to run the app
Now I changed the simulator to iPhone 5- 7.1 by following this -https://stackoverflow.com/a/24038727 and changing the deployment target to 7.1.
Now I can see my iOS 7.1 simulators
When i try to run it I get build succeeded but the app crashes with swift dynamic cast excption
libswift_stdlib_core.dylib`swift_dynamicCast:
The Master-Detail Xcode project template creates a storyboard with a UISplitViewController as the root view controller.
Before iOS 8, UISplitViewController was iPad only. The documentation states:
In iOS 8 and later, you can use the UISplitViewController class on all
iOS devices; in previous versions of iOS, the class is available only
on iPad.
You might want to load a different storyboard for devices running an older version of iOS. I've been wondering how apple wants us to approach this with iOS 8. It might be a good idea to read up on what Apple calls Adaptive View Controllers, or watch a WWDC video on them. I believe "Building Adaptive Apps with UIKit" covers the new functionality of UISplitViewController

How to launch app into background on iOS simulator?

Events like location changes launch concerning app into background if it is not launched yet. But I don't see how to simulate such scenarios on simulator. Is it possible? How?
It's not possible with iOS Simulator found in current public SDK.
I know this is borderline breaking NDA, but you should take a look at Hardware menu item of new iOS Simulator that comes with Xcode 4.2 beta.

Resources