I'm trying to add a quick look preview extension to my app.
But
I can't find any reference on this
On a earlier thread (https://developer.apple.com/forums/thread/704155)
everyone seems to misunderstand my question.
I MEAN THE QUICK LOOK YOU CAN TOGGLE IN FINDER THAT WILL SHOW YOU A PREVIEW OF A DOCUEMNT
I don't want to add the tag QuickLook because that's not I want to do.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
How could I create an icon with an alpha/beta/dev badge?
like this⬇️
How can I make it work?
jsonString = """
["foo", "bar"]
"""
let decoder = JSONDecoder
var whatIWant = decoder.decode(Array<String>.self, jsonString)
for i in whatIWant {
print(i)
}
EDIT:
Minor syntax mistake ignore this thread sorry everyone
OK after I'm done with my last issue I came across some weird UI layout
this is really a serious issue because afterward it looks like this😂
why?
I've never met this kind of issue before in my same code before upgrading to Ventura
code:
List {
...
Section {
ForEach(data) { datum in
TableRow(data: datum)
.swipeActions {
Button(role: .destructive) {
data.delete(datum)
} label: {
Label("Delete", systemImage: "trash")
}
}
}
}
...
}
I know this is a strange and easy question.
but JUST CANT FIND ANY REFERENCE aaaaaaaa
I'm using SwiftUI and wants to
export to PDF (best I can find Creating PDFs on MacOS without UIKit)
export to image
export to HTML
export to everything possible etc
BONUS print the page
I can only find UIKit support and they are all outdated. AND IF POSSIBLE how to integrate ShareLink to share these(PDF, Image, HTML, etc) and write them onto disk using NSSavePane?
even better
how to do this on a of the platforms
(I know I'm greedy😂)
Thanks for any help🙏
I have a structure TodoItem
struct TodoItem: Codable, Hashable, Identifiable {
var id: UUID = UUID()
var item: String
var done: Bool = false
}
And I have an array of them, and I’d like to find out a way to calculate(in a array) how many are done; that is, myArray.count / itemsDone
.count is easy, itemsDone can be achieved like this:
extension Array where Element == TodoItem {
var itemsDone: Double {
var done: Double = 0
for i in self {
if i.done { done += 1 }
}
return done
}
}
but it didn’t.
struct ContentView: View {
@State var todos: [TodoItem]
…
ProgressView(value: todos.itemsDone / todos.count) // Error
My Playground won’t let me copy the error(no idea why) and my family’s iPad is in Chinese so one is Chinese. I’ll try it on Xcode and see if I can find out more. will update with the error.
EDiT
nor will this work:
ProgressView(value: todos.itemsDone, total: todos.count)
⬆️
(for a bug fix on counting a array’s proportion of models that contains a certain value)
I have this:
struct TableRow: View {
@Binding var data: TodoItem
var body: some View {
...
}
}
and this:
List {
ForEach(data) { datum in
TableRow(data: ???) // <- what goes here?
.swipeActions {
Button(role: .destructive) {
data.delete(datum)
} label: {
Label("Delete", systemImage: "trash")
}
}
}
}
How can I achieve a source code editor in SwiftUI like Xcode, highlighting all the keywords and things like that. I've tried Regex + AttributedString... To hard... Anyone has any idea?
Feedback is filed. Trying to look into the Core.swift.
diagnostics:
Unsupported: 'Consumer for unconverted(_StringProcessing.DSLTree._AST.Atom(ast:
----------------------------------------
CrashReportError: Fatal Error in Core.swift
UtilityScript crashed due to fatalError in Core.swift at line 77.
'try!' expression unexpectedly raised an error: Unsupported: 'Consumer for unconverted(_StringProcessing.DSLTree._AST.Atom(ast:
))'
Process: UtilityScript[3141]
Date/Time: 2022-07-02 03:56:17 +0000
Log File: <none>
Application Specific Information:
dyld [
dyld config: DYLD_LIBRARY_PATH=/Users/wangkeshijian/Library/Developer/Xcode/DerivedData/UtilityScript-frovasvohxblobefzbrrwtvqtyuu/Build/Intermediates.noindex/Previews/UtilityScript/Products/Debug DYLD_FRAMEWORK_PATH=/Users/wangkeshijian/Library/Developer/Xcode/DerivedData/UtilityScript-frovasvohxblobefzbrrwtvqtyuu/Build/Intermediates.noindex/Previews/UtilityScript/Products/Debug
]
libswiftCore.dylib [
_StringProcessing/Core.swift:77: Fatal error: 'try!' expression unexpectedly raised an error: Unsupported: 'Consumer for unconverted(_StringProcessing.DSLTree._AST.Atom(ast:
))'
/AppleInternal/Library/BuildRoots/0cc5e7ad-e86f-11ec-ac50-3e2aa58faa6a/Library/Caches/com.apple.xbs/Sources/swiftlang_overlay_Platform/swift-experimental-string-processing/Sources/_StringProcessing/ConsumerInterface.swift:200
]
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
Debugging
Xcode Previews
wwdc2022-110357
wwdc2022-110358
macOS Ventura 13 beta 2
I'm coming over with a really strange issue with my cursor. It'd move toward the right-down by itself one pixel a time: right down right down
It really freaked me out *laugh*
I'll try attaching a video. FB submitted.
I've just bought a M2 MacBook Pro, and my Timer app is giving me strange crash logs.
Here's my code:
struct ContentView: View {
@State var process: Any? = nil
@AppStorage("time") var time = 0
@State var timePassed = 0
@State var timer: Timer.TimerPublisher = Timer.publish(every: 1, on: .main, in: .common)
@State var cacheSecondsString: String = String(UserDefaults.standard.integer(forKey: "time"))
@State var startTheTimer: Bool = false
var body: some View {
ZStack {
TimerView(time: $timePassed, total: $time).padding()
VStack {
TextField("Time...", text: $cacheSecondsString)
.font(.system(size: 35, weight: .light, design: .rounded))
.multilineTextAlignment(.center)
.onSubmit {
time = Int(cacheSecondsString) ?? time
cacheSecondsString = String(time)
}
.textFieldStyle(.plain)
.padding()
.fixedSize()
Button {
withAnimation {
startTheTimer.toggle()
}
} label: {
Label(startTheTimer ? "Stop" : "Start", systemImage: startTheTimer "stop.fill" : "clock").foregroundColor(.accentColor)
}.buttonStyle(.plain).padding()
}
}.onChange(of: startTheTimer) { start in
if start {
process = timer.connect()
} else {
(process! as! Cancellable).cancel()
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.previewDevice("iPad Air (5th generation)")
}
}
When I sort of "run" the preview (pressing on the play.circle button on top of my preview and press the button the second to deactivate my timer, a crash dialog appear, the standard one macOS uses when any process crashed, but the preview didn't crash.
Because of some problems I turn again to Monterey
in this thread, @ekimo says that to use ad hoc you need to archive a iOS App
however:
what did I did wrong?