Post

Replies

Boosts

Views

Activity

Reply to NSPrintInfo design report
The way I do it is to design the report as a view in code. Schematically, it will be: I create a PrintView and house all the drawing in the draw function class PrintView: NSView { override func draw(_ dirtyRect: NSRect) { super.draw(dirtyRect) // Drawing code here. } } Then, to print, I call (from the handler of Print menu command for instance or from a print button in a view) let aSize = NSSize(width: printInfo.paperSize.width - 20, height: totalHeight) let printView = PrintView(frame: NSRect(origin: NSPoint(x: 1, y: 10), size: aSize)) // a full page, depending on orientation and call the printPanel         let printOp = NSPrintOperation(view: printView, printInfo: printInfo)
Topic: UI Frameworks SubTopic: AppKit Tags:
Apr ’21
Reply to Generating strings file with genstrings
A suggestion. Instead of the func, you could define String extension, with a property or a func extension String { var localized: String { NSLocalizedString(self, comment: "") } mutating func localize(comment: String = "") - String { NSLocalizedString(self, comment: comment) } } then you can call myString.localized or myString.localize() or myString.localize(comment:"Some comment") print("hello".localized) var myString = "hello you" myString = myString.localize(comment: "Some comment") // or myString = myString.localize() without comment print(myString)
May ’21
Reply to iOS 14.5 issues
Are they your own apps (ones you developed) or apps you downloaded. For the latter, what problem do you get ? For the former, did you try to update the app ? If you search on Google 'downgrade from iOS 14.5 to 14', you will find a lot of material. In any case, do a complete backup of your iPhone before, there is always a real risk to loose all your data.
Topic: App & System Services SubTopic: Core OS Tags:
May ’21
Reply to Generating strings file with genstrings
writing "bla-bla-bla".localized looks ugly for my taste.  You're right, that's a question of taste. But there are already a lot like this in StringProtocol: "bla-bla-bla".localizedUppercase or "bla-bla-bla".localizedCapitalized If you need to keep your func, why not change it as: func localized(_ string: String, comment: String = "") - String { NSLocalizedString(string, comment: comment) } Doing so you can still call: cell.label.text = localized("Hello world")
May ’21
Reply to SwiftUI App crash after keyboard show
Video is inaccessible. When running your code, just get a screen with show second view at top Tab 1 Un in the middle a field on the left at the middle, but quasi hidden a tab bar at bottom when I click button Which button, please be more precise I clicked on secondView only change state button which returns to the first view, just changed with Tab 1 Der in the middle Impossible to test anything.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’21
Reply to SwiftUI App crash after keyboard show
OK, I could reproduce the crash (after deselecting I/O Keyboard Connect Hardware Keyboard). The crash seems due to the 2         switch tradingMode { } section If I comment out any of them, no more crash. If I reconnect Hardware Keyboard; no crash either. So problem is effectively caused by showing keyboard. Some conflict with the tabs ? I also get a crash if I tap on tab 2, without any keyboard. So there is a problem with tabs. I'll look further to it. I run Xcode 12.4 on MacOS 10.15.7
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’21