(Swift, macOS, storyboards.)
I have a window that is semitransparent and a NSView that I want to be not transparent or with a different transparent degree.
With my code, if I make the window transparent the NSView is also transparent.
func finestra() {
self.view.window?.alphaValue = 0.7
}
func nsView1() {
nsViewOutlet.wantsLayer = true
nsViewOutlet.layer?.backgroundColor = NSColor.white.cgColor
nsViewOutlet.alphaValue = 1
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
I want my program to do something at a specific time. This is what I have tried:
func rellotge() {
countdownRellotge = Timer.scheduledTimer(timeInterval: 1,
target: self,
selector: #selector(actualitzaRellotge),
userInfo: nil, repeats: true)
}
@objc func actualitzaRellotge() {
let date = Date()
let calendar = Calendar.current
hour = calendar.component(.hour, from: date)
minutes = calendar.component(.minute, from: date)
seconds = calendar.component(.second, from: date)
//print (minutes, ":", seconds)
if (minutes == 40 && seconds == 0){
print ("do something")
}
}
This does not work if the computer goes to sleep. Even before that, it becomes buggy. (When I print the seconds, it seems that sometimes it skips some seconds)
How can I reliably make my program do something at a specific minute-second?
I have created a small app for macOS. I looked for information about how to submit it to the app store and read: "Build your apps using Xcode 13.1 or later…"
https://developer.apple.com/macos/submit/
I have an old iMac Late 2013. Unfortunately, the last version I can install is Catalina 10.15.7, and the last Xcode I can install is version 12.4. Does it mean that I cannot publish my app? Is there any way I can submit it? Is buying a new mac the only solution?
My iMac works well, and it is not easy for me to buy a new one.
I would appreciate any recommendation
Thank you
Xcode 16.2
Swift 6
macOS Sequoia 15.1
SwiftUI
I am a beginner.
If I understand we can add buttons to the default Menu Bar but not delete them. Am I right? If you do not need most of the buttons, how do you solve that?
I can add a button:
import SwiftUI
@main
struct NouMenuProvesApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
.commands {
CommandMenu("Custom") {
Button("Custom Action") {
print("Custom Action performed")
}
}
}
}
}
Can I delete a Menu Button or create a new simpler Menu Bar?