Post

Replies

Boosts

Views

Activity

Reply to Changing Views Bar
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") } } } }
Jun ’22
Reply to Allow developer access to only 1 app
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.
Jun ’22
Reply to NSDateFormatter dealloc EXC_BAD_ACCESS
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.
Jun ’22
Reply to using and calling functions inside my view file
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) } } }
Jun ’22