How can i write an About page in swiftUI about my app? I cant find any documentation on it
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I want to include a button that could export some data but I'm stuck:
I want a NSSavePanel open up and when I choose the pass and click save the JSON file will appear but it didn't.
code:
Button {
let export = exportToJSON(toExported(data.data))
let openPanel = NSSavePanel()
openPanel.message = "Choose the exported path:"
openPanel.begin { response in
if response == .OK {
print("\(openPanel.url!)")
url = openPanel.url!
let fileManager = FileManager()
let success = fileManager.createFile(atPath: "\(url)", contents: export)
debugPrint(success)
}
}
} label: {
Image(systemName: "square.and.arrow.down")
}.padding().buttonStyle(.plain)
console:
file:///Users/xxx/Documents/Untitled
false
My SceneKit Game failed with a
com.apple.scenekit.scnview-renderer (10): signal SIGABRT
The error was marked on the line
@main
Here's the log navigator:
2022-05-25 15:24:18.829319+0800 MyWorldiOS[9022:293392] Metal API Validation Enabled
validateRenderPassDescriptor:899: failed assertion `RenderPass Descriptor Validation
MTLRenderPassAttachmentDescriptor MTLStoreActionMultisampleResolve store action for the depth attachment is not supported by device
PixelFormat MTLPixelFormatDepth32Float cannot be a MSAA resolve target
'
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/wangkeshijian/Library/Developer/Xcode/DerivedData/MyWorld-aayoxjgvyfzbxvgqnvylzgvlwkyr/Build/Products/Debug-iphonesimulator:/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Users/wangkeshijian/Library/Developer/Xcode/DerivedData/MyWorld-aayoxjgvyfzbxvgqnvylzgvlwkyr/Build/Products/Debug-iphonesimulator
validateRenderPassDescriptor:899: failed assertion `RenderPass Descriptor Validation
MTLRenderPassAttachmentDescriptor MTLStoreActionMultisampleResolve store action for the depth attachment is not supported by device
PixelFormat MTLPixelFormatDepth32Float cannot be a MSAA resolve target
'
CoreSimulator 802.6 - Device: MyPhone (EBB1ECDE-8AD7-4418-84AF-0B761E0A2EA7) - Runtime: iOS 15.4 (19E5234a) - DeviceType: iPhone 12
(lldb)
I'm not sure what else should I put in here
My iPhone SE 1st will be stuck every 30 secs or so
I think it's sth because it's a second-handed one
I've used Instruments but can't find anything
Anyone HELP
Thanks🙏
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.
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
2022-06-09 08:51:30.793789+0800 MyAppName[4651:447798] [aqme] MEMixerChannel.cpp:1629 client <AudioQueueObject@0x7fc09a04f400; [0]; play> got error 2003332927 while sending format information
I use .mp3
I know this is really easy
I want to get the absolute path for the current app
And I can achieve using
String(reflecting: Bundle.main.bundleURL)
But what outputs isn't like /User/xxx/.....
but file:///User/xx/...
so
what can I do to get a absolute path in /xxx/xxx/xxx format?
thanks
I know how to use Virtualization now
But I don't know how to write interface in AppKit
So I should find a way to embed a NSView(the VM's UI) in a SwiftUI View
However
I couldn't find any reference on how except NSViewRepresentable which, of course, will not work
I know there must be a easy way to do this
But I'm just can't find it...
any help is appreciated
I'm trying out Swift Charts and I'm pretty messed up
After I deleted all of my items, I couldn't add items anymore
import SwiftUI
extension Array where Element == ChartsData {
mutating func delete(_ item: ChartsData) {
self.removeAll {
$0 == item
}
}
}
struct ContentView: View {
var ofType: ChartsType
@State var data: [ChartsData] = []
var body: some View {
List {
VStack {
HStack {
Spacer()
// MARK - add button
Button {
data.append(ChartsData(item: "item"))
} label: {
Image(systemName: "plus").imageScale(.large)
}.buttonStyle(.plain).padding()
}
List {
ForEach(data) { datum in
TableRow(data: datum).swipeActions {
Button(role: .destructive) {
data.delete(datum)
} label: {
Label("Delete", systemImage: "trash")
}
}
}
}
NavigationLink{
ChartsView(ofType: .BarChart, data: data)
} label: {
Text("Generate").font(.largeTitle).foregroundStyle(.linearGradient(colors: [.orange, .yellow, .blue, .purple], startPoint: .topTrailing, endPoint: .bottomLeading))
}.padding()
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView(ofType: .BarChart, data: [
ChartsData(item: "testItem1", value: 10),
ChartsData(item: "testItem2", value: 20)
])
}
}
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'm trying out weather kit and I'm using swiftUI
I have a view that accepts a CurrentWeather type value in initailizer
I cannot find a way to initialize a CurrentWeather
How can I preview It?
This won't work:
// forecaster and forecast is defined by me
struct WeatherView_Previews: PreviewProvider {
static var previews: some View { // <- static
WeatherView(weather: await forecaster.forcast(latitude: 0, longtitude: 0)) // <- concurrency
}
}
Is it legal if I distribute Ventura 13.0 beta 1 to a beta tester?
I have a structure TodoItem
struct TodoItem: Codable, Hashable, Identifiable {
var id: UUID = UUID()
var item: String
var done: Bool = false
}
How can I use AppStorage on [TodoItem]?
⬆️
(for a bug fix on counting a array’s proportion of models that contains a certain value)