In the Preview, you need to pass a "scannedCode" to your "PageThree" struct.
Try this:
struct PageThree_Previews: PreviewProvider {
static var previews: some View {
PageThree(scannedCode: "some text...")
}
}
Post
Replies
Boosts
Views
Activity
Instead of:
let mylocation = String(location)
Try:
let mylocation = String("\(location.x),\(location.y)")
From the Xcode 14 Beta Release Notes
Xcode 14 beta requires a Mac running macOS Monterey 12.4 or later.
Some features require Apple silicon, but Xcode 14 itself does not.
Try something like this, to get started:
struct TabScreen: View {
var body: some View {
TabView() {
Text("HomeScreen")
.tabItem {
Image(systemName: "house")
Text("Home")
}
Text("NotificationsScreen")
.tabItem {
Image(systemName: "bell")
Text("Notifications")
}
Text("ExploreScreen")
.tabItem {
Image(systemName: "binoculars")
Text("Explore")
}
Text("ProfileScreen")
.tabItem {
Image(systemName: "person")
Text("Profile")
}
}
}
}
On App Store Connect, under Users and Access:
Having set the "Role" for a developer, you can set the "Apps" that they have access to.
This can be:
All Apps
or one or more specific apps (which you can choose from a drop-down list)
Of course, the Apple account itself, and the Account Holder role, should be under your control.
For the "Developer" role, you may need to add additional permissions such as "Access to Certificates, Identifiers and Profiles", depending on how you manage the app.
A full list of permissions for each role is shown, on tapping the role.
You mean a TabView?
It looks like having both axes in your ScrollView is forcing the content to the center.
Removing .horizontal sends it to the top.
So as a possible fix (here's a minimal example), try:
var body: some View {
ScrollView(.horizontal, showsIndicators: true) {
ScrollView(.vertical, showsIndicators: true) {
ZStack {
Text("content appears at top")
}
}
}
}
Should it be Memo1.string.length - 1 ?
You are talking about NOT
With a Swift Bool, you can use toggle()
What Edit Menu?
DateFormatter is now threadsafe, but creating one is quite expensive.
You certainly shouldn't be creating one every time you call logToFile!
So you might try using an extension, like this:
extension DateFormatter {
static let myFormatter: DateFormatter = {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS"
formatter.timeZone = TimeZone(secondsFromGMT: TimeZone.current.secondsFromGMT())
formatter.locale = Locale(identifier: "en_US_POSIX")
return formatter
}()
}
(Give it a more meaningful name, of course)
Then in your logToFile, you can use it like this:
let localDate = DateFormatter.myFormatter.string(from: Date())
This will be more efficient, and should fix your issue.
It's Betas all the way down.
Ventura > Xcode 14 > iOS 16
The future does not look good for Intel Macs, Looking at the rate they are being dropped from macOS Ventura support.
Some Ventura features are also exclusive to Apple Silicon Macs.
The line:
public func storeFaveArtwork(artwork) {
does not make sense.
I would expect something like:
public func storeFaveArtwork(artwork: Artwork) {
As the compiler says, you have put too much functionality into one View.
Even if the code is legal, it's not good practice.
Refactor, breaking up your functionality into smaller components.
You have made it a bit hard to be more specific, as your sample code includes a lot of external/undefined objects and functionality.
As a starting point, you could refactor the internal VStack and HStacks into separate Views.
You could factor out the Button, like this:
struct StoreFaveArtworkButtonView: View {
let artwork: Artwork
private func storeFaveArtwork(artwork: Artwork) {
guard let uid = FirebaseManager.shared.auth.currentUser?.uid else {
return
}
let artData = ["id": artwork.id, "uid": uid] as [String : Any]
FirebaseManager.shared.firestore.collection("favourites")
.document(uid).setData(artData) { err in
if let err = err {
print(err)
return
}
print("Success")
}
}
var body: some View {
Button {
storeFaveArtwork(artwork: artwork)
} label: {
HStack {
Spacer()
Text("Favourite")
.foregroundColor(.white)
.padding(.vertical, 10)
.font(.system(size: 14, weight: .semibold))
Spacer()
}.background(Color.blue)
}
}
}