Post

Replies

Boosts

Views

Activity

Reply to UITableView indexPath changing while scrolling
You are using meterNumber which is not defined in your shown code. Usually, having other variables than data source can easily cause issues as you describe. Also, you are setting textColor to .systemRed, but there is no code which changes textColor to the normal color, please do not forget that cells are reused, the textColor of the cell dequeued is not known. Anyway, to find how to fix, you may need to show more context.
Topic: UI Frameworks SubTopic: UIKit Tags:
Sep ’21
Reply to Swift generic usage inside class
What you are trying is not possible in the current type system of Swift. Better do the one way to solve even when you need to modify thousands of lines in your project. (Not exaggerating, assuming less than thousands.) Or else, if you could show very detailed info of the usage of EffectModel especially the property keyframeGroup, there might be other better workarounds. But anyway, you might have to modify EffectModel itself, under the current type system of Swift, no declaration using incomplete generic type like :[Keyframe<EffectParam>] is allowed.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’21
Reply to MPRemoteCommandCenter - Show Now Playing info
I have not played with MPNowPlayingInfoCenter, but you should better try doing it in the completion handler of the API call: override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. overrideUserInterfaceStyle = .light setupRemoteTransportControls() requestNowPlaying() //setupNowPlaying() addInterruptionsObserver() } //... DispatchQueue.main.async { self.songArtUrl = artUrl let albumArt = UIImage(data: imageData) self.artUrl.image = albumArt //Why don't you rename this, `artUrl` is not of type `URL`, very confusing... self.setupNowPlaying( artist: radio.nowPlaying.song.artist, title: radio.nowPlaying.song.title, artwork: albumArt) //<- } //... func setupNowPlaying(artist: String, title: String, artwork: UIImage?) { // Define Now Playing Info var nowPlayingInfo = [String : Any]() nowPlayingInfo[MPMediaItemPropertyTitle] = "\(artist) - \(title)" //<- nowPlayingInfo[MPMediaItemPropertyArtist] = "My name as string - nothing to change" if let image = artwork ?? UIImage(named: "Deault_albumart") { //<- nowPlayingInfo[MPMediaItemPropertyArtwork] = MPMediaItemArtwork(boundsSize: image.size) { size in return image } } nowPlayingInfo[MPNowPlayingInfoPropertyIsLiveStream] = true MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo }
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’21
Reply to Can i Update my App with new project?
I recently published an app in the store. The app was created with a provider. Can I develope my own „new project“ and publish it as a 1.2 version? And terminate the provider. Or is that not possible? It depends on how the app is published on the App Store, if it is published with the Apple ID of the provider, the author of the app is the provider (from Apple's point of view). Unless the provider gives the ownership of the app in the way Apple defines to you, there's no way you can touch it. In case it is you who published the app using your own Apple ID, no problem. (Assuming you have not told the credentials of your Apple ID to anyone else.) Create an updated app with your own new project, better hold the same bundle ID, and submit it as the new version of your app.
Sep ’21
Reply to Open a View from the menu
You should better do it in the usual way of macOS programming. (You have no need to define your own nib, you have no need to define global variables.) Assuming you already added menu items Open view 1 and Open view 2 as in the screen shot, and the Custom Classes of the two view controllers are FirstViewController and SecondViewController. (The first may be ViewController, then you may need to replace FirstViewController to ViewController in the following code.) 1. Create a new file MyWindowController.swift and define the IBActions for Open view 1 and Open view 2 in it. MyWindowController.swift: import Cocoa class MyWindowController: NSWindowController { @IBAction func openView1(_ sender :Any) { guard let storyboard = self.storyboard else { return } let firstViewController = storyboard.instantiateController(withIdentifier: "FirstView") as? FirstViewController self.window?.contentViewController = firstViewController } @IBAction func openView2(_ sender :Any) { guard let storyboard = self.storyboard else { return } let secondViewController = storyboard.instantiateController(withIdentifier: "SecondView") as? SecondViewController self.window?.contentViewController = secondViewController } } 2. In the Interface Builder, change the Custom Class of your Window Controller to MyWindowController. 3. Connect the action of the menu item Open view 1 to openView1: of First Responder. (A pop up list is shown when you release the mouse button, you can choose openView1: from the list.) 4. Connect the action of the menu item Open view 2 to openView2: of First Responder as well. 5. Run your code. If you find something wrong, please tell me. I did test.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’21
Reply to Swift Playgrounds in iOS15
the new interface announced at WWDC21 I may be mistaking what you mean by the new interface, but the latest iPadOS 15 page says that the new SwiftPlaygrounds is Available late 2021. (Please check another answer of mine.) You may need to wait a little more.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’21
Reply to What exactly is CIImage extent
The doc of extent says: This rectangle specifies the extent of the image in working space coordinates. In other words, it is a rectangular region which the processed image is expected to occupy in the same coordinate as in the original image. Don't you think it is quite reasonable you get negative values when you applied rotation on the image?
Topic: UI Frameworks SubTopic: UIKit Tags:
Sep ’21