Search/Text Field in OSX Menu Bar Application - swift

I have seen this example in Obj-C development for OSX, but I was wondering if it is possible to insert a Search Field or a Text Field into a Menu Bar application using Swift.
Here is an example of an application, but in Obj-C
S/S Example App

Yes,follow along this tutorial. It shows how to use NSPopover. You can use NSPopover's view outlet to customize your user interface, which is a NSTextField in your case.

Related

Status bar menu for Mac Catalyst in .NET MAUI

I have been working on an .NET MAUI app that needs to have a status bar icon and when clicked, menu to be shown. I know it is a platform specific issue and I have been folowing this tutorial from Microsoft. They have image button implemented to be shown in the status menu bar in the TrayService.
This runtime binding and creating objects are diffucult to me. The idea is to create NSMenu object, assign it to the NSStatusBar object, then create NSMenu Items with appropriate click events and assign them to the NSMenu object.
I am struggling since I don't know how to create the NSMenu object, and NSMenuItem objects with Title property for example.
NSMenu have many constructors, properties, methods to use and I don't know how to use them.
I will be very greatful with explanation or example on how to start.
_statusBarMenu = Runtime.GetNSObject(Class.GetHandle("NSMenu"));
IntPtr_objc_msgSend_String(_statusBarMenu.Handle, Selector.GetHandle("initWithTitle:"), "Quit");
void_objc_msgSend_IntPtr(_statusBarItem.Handle, Selector.GetHandle("setMenu:"), _statusBarMenu.Handle);
This compiles fine, but I don't know if IntPtr_objc_msgSend_String method exist because I added it myself at the top. However, nothing shows up in the tray.
It should be noted that Mac Catalyst is used in Maui, NSMenu and NSMenuItem are in Macos, and are not supported in Maui. For the Mac Catalyst creation menu in Maui you can refer to:
Menubar
Adding Menus and Shortcuts to the Menu Bar and User Interface | Apple Developer

How to build Insert Remove Form with Xcode Object Library for Cocoa Swift?

Rocket for Mac has a Preferences Window in which it has a form like below to insert & remove an app.
I want to make a form like that but how should I build it? I am new to Cocoa development so this might be obvious.
I want to make the one with the label Disable Rocket within these apps:
I found a solution.
What I did was use NSTableView with single column for the textbox. And made the NSTextField in it to be text editable using the Behaviour attribute.
Then for the + & - button I used 2 NSPopupButton & made the Image attribute to be NSAddTemplate & NSRemoveTemplate which exists by default in Xcode. There are bunch of other images that are default in it.
That solved it for me :)

Add a checkbox (or similar) to iPhone app using XCode

I notice in Objects Library when I'm in editor, there are checkboxes. But they disappear when I go to the storyboard. So is there a way to add a chechbox in iPhone interface or are they meant for other platform? If it's not possible, is there something else that could do the same job? I'm making a search function and I want a criteria to be added in the search if the chechbox is checked, that's why I need something like that. Thanks.
Checkboxes are for OS X. The iOS equivalents are switches. If they aren't appropriate, you can roll your own checkbox using buttons.

What type of iOS project template should I start with?

I'm building a project similar in design/scope to Invoice2Go and was wondering what the appropriate iOS project type would be to start with in XCode.
It doesn't really matter, from the most basic template (Window-based Application) you can setup any app. It seems Invoice2Go makes use of a tab bar, so the Tab Bar application seems most convenient, though you can add a tab bar to the Window-based Application as well.
Personally I like to start with a Window-based Application most of the time, this gives me the most flexible starting-point.
I think the app looks like Tab Bar based application. You can try using that template. Of course you can start with simple Window based app, but you need to wire it all up yourself.

iPhone Beginner Question - Hooking Up Actions

I'm just starting out with iPhone development, and in my hello world application I'm having a hard time hooking up a view to a controller with actions. I followed the instructions in the book I'm reading (I believe), but depending on where I run the application the app behaves differently.
-When i command-r from the code, I see only the single button I have on the view taking up the whole window. When I click the button the action is triggered.
-when I command-r from the interface designer I see the button, label, and textbox lined up correctly. When I click the button nothing happens.
Anyone know why this is happening/how to fix it? Thanks.
Launching simulator from interface builder only simulates selected .xib file. You should only do that to test your view design.
If you want to learn the basics about iPhone development I recommend:
NewBoston: http://www.thenewboston.com/?cat=34&pOpen=tutorial
Stanford: http://itunes.stanford.edu/
both are free video tutorials on how to make iPhone apps.
Good luck!
you accidentally the whole view.
Seriously. You made one wrong connection. You connected the view outlet of the viewController (aka File's Owner) with the UIButton.
just delete this connection and connect the view outlet of the File Owner with the "Root"View.
And you should probably remove almost all connections that trigger btnClicked: too. TouchUpInside from the button is enough.
And you should follow the objective-c coding style (Part II) and start all Class names with a capital letter. chapter_2ViewController should be something like Chapter2ViewController.
To my knowledge you cannot run an app from interface builder, I may be mistaken.
You should make sure your interface builder file is saved and run the app from within xcode
just a guess, but is the window size in the simulator different than that in IB? You might check the control resizing masks and on the sizing tab in IB.