How to arrange app on the screen using Accessibility API for macOS? - swift

Goal: Arrange window/app to a specific position and size on macOS screen
I've tried to achieve it using Apple-script, here is an example
tell application "System Events" to tell application process "Google Chrome"
activate
set frontmost to true
tell window 1 to set {size, position} to {{1920 / 3, 996 / 2}, {0, 0}}
end tell
Since, I use Apple-script I have to uncheck sandbox from Xcode project settings which I hate it. I want my app to be part of Appstore, I assume to do that I should be able to mimic the above apple-script using Accessibility APIs but I am not quite sure where to start as it is very unclear where to start.
Tech goal: Able to arrange app on the screen using Accessibility APIs
Any guidance or working example would be great.

Related

Template10 overwriting Windows Mobile System Header

Doing some testing with Template10 I noticed that with say Hamburger Template that the windows system header/menu/whatever its called at the very top of my Windows Mobile 10 screen goes white and none of the icons (time, battery level, wifi signal etc) are visible when the light theme is used but they appear if I use the black theme.
If I use the Minimal Template then the system menu isn't visible with either the dark or light themes, its just a white band at the top.
Any idea on how to fix this? I'm running a 950XL if that matters.
That is a function of the theming and you need to account for it with the application being "mobile". The so called "System Menu" is the StatusBar
I added this to the OnInitializeAsync in the App.xaml.cs file
if (ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1, 0))
{
var statusBar = StatusBar.GetForCurrentView();
statusBar.BackgroundOpacity = 1;
}
and that seems to fix the problem. Not sure how portable this is as I'm just targeting Windows Phone for this app so I haven't tried testing other platforms.

iPhone - Sending the app to the background

In my app, when it runs for the first time, it shows a UIViewAlert and offers you to see the preferences for the app - and the user has 2 choices - yes or no. If the user hits no the alert fades away and the application continues running. I want to set it in such a way, that if the user hits yes, my app will go to the background, the settings tab of the app will be opened (I added a settings bundle to the app). Is it possible to do such a thing? Thanks!
No, this is not possible. But you can create a settings view in you app and show it instead of trying to open the settings app.
Normally, you do want to encourage users to use your app as long as possible, and making them quit your app yourself is not the best way to achieve that.
No, this isn't possible.
But you could use InAppSettingsKit and modally show a view controller with the settings inside the app.
You can find out more here - http://www.inappsettingskit.com/

Disable specific settings dynamically

I am developing an iPhone app which uses Settings.bundle to let the user choose some options.
I have two questions regarding this:
How can I completely remove/hide some setting? (for instance if the app is running on iPhone 3G I want to hide settings regarding the compass)
How can I disable (fade) a setting? (for instance, I have two Toggle Switches and if the first is set to OFF the second one has no meaning and should be disabled)
You can't. Your app cannot dynamically influence what is shown in the Settings app.

how to know iphone applicaton template?

already iphone implemented app running on xcode so how you know, which type of iphone template (view based or window or tab based....)is selected while development?
It doesn't matter. The template is just something to get you started. You can still change your app to be however you like after you've started development.
I don't think it's possible because all that templetes are just conventionalities. However if there is tab bar controller, then you can suppose that this is tab based app.

App running in background despite plist saying not to

In my appname-Info.plist
I have 'Application does not run in background' box checked.(it is ticked)
But when i press the button under the screen to close the app, and then double press the button it shows the list of apps and my app is there among the list of currently running apps. Does this mean that my app is running in the background?
If so is there a fix for this? I'd like to make sure my app is completely dead when user quits it.
Thanks
-Code
Your app is not running in the background after you close it.
Even if you see it in the switcher app list.
Application has different states
Active
InActive
Running in Background
Your application become in-active, not running in background.
Aplications are allaowd to run in the background only for:
Playing music.
Navigation needs.
VOIP (as Skype).
And you should explicitly ask the permission and set the appropriate code for doing that and not only check the 'Application does run in background' in the info.plist
The list you get when you double tap the home button is not a running applications list. That's a common misconception. It's actually a list of recently launched applications. Therefore it makes sense for your app to be in it even if it doesn't multitask.