Posts

Post not yet marked as solved
1 Replies
1.4k Views
TextView has a function: func textView(_ textView: UITextView, editMenuForTextin range: NSRange, suggestedActions: [UIMenuElement]) -> UIMenu? {... } to add custom UlAction into context menu. But PdfKit has no way to insert a custom UlAction into the context menu popped up by long press on PdfView page.
Posted
by Nuix.
Last updated
.
Post marked as solved
1 Replies
1.1k Views
We use NSLayoutManager/NSTextStorage/NSTextContainer to display markdown attributed string on a canvas. MarkDown string was processed properly, but NSLayoutManager just exhibits the plain text. The code is as follows:     var layoutmanager = NSLayoutManager()     var textstorage = NSTextStorage()     var textcontainer = NSTextContainer()   var attrStr = try AttributedString.init(markdown: "**test**", options: AttributedString.MarkdownParsingOptions(interpretedSyntax: .inlineOnlyPreservingWhitespace)) var attrString = NSMutableAttributedString(attrStr)  self.textstorage.setAttributedString(attrString!) // draw text layout     let range = self.layoutmanager.glyphRange(for: self.textcontainer)     self.layoutmanager.drawBackground(forGlyphRange: range, at: self.textLocation)     self.layoutmanager.drawGlyphs(forGlyphRange: range, at: self.textLocation) Is it because TextKit 1 does not support markdown string display or I miss something else ? Any help will be appreciated. Thanks!
Posted
by Nuix.
Last updated
.
Post marked as solved
1 Replies
2.9k Views
WWDC2020 videos said SwiftUI on Xcode12 can create and manage different scenes in an App, but we do not find out any API could do that. We try the method  of SwiftUI on Xcode11 to create new Window on Xcode 12 : UIApplication.shared.requestSceneSessionActivation(nil, userActivity: nil, options: nil, errorHandler: nil) }) But it does not work as we expect. The code create a window of the same scene. If we set a different userActivity, SwiftUI have no method to set SceneDelegate.swift. It only has @UIApplicationDelegateAdaptor to set AppDelegate.  So, I Wonder whether there is a convenient way to create a new Scene by new SwiftUI APIs. The following code can only create Scenes with the same content view : @main struct test: App {       let newWindowPublisher = NotificationCenter.default.publisher(for: Notification.Name("anotherScene"))       var body: some Scene {             WindowGroup {                    ContentView()                          .onReceive(newWindowPublish, perform: { info in                             UIApplication.shared.requestSceneSessionActivation(nil, userActivity: nil, options: nil, errorHandler: nil) })             }        } }
Posted
by Nuix.
Last updated
.