0
0
iOS Swiftmobile~20 mins

App review guidelines in iOS Swift - Mini App: Build & Ship

Choose your learning style9 modes available
Build: App Review Guidelines
This screen shows a list of important app review guidelines for iOS developers. Users can scroll through the guidelines to understand what Apple expects before submitting an app.
Target UI
---------------------------------
| App Review Guidelines          |
|-------------------------------|
| 1. Follow Apple's content rules|
| 2. Ensure app stability        |
| 3. Use proper user interface   |
| 4. Respect user privacy        |
| 5. Provide accurate metadata   |
|                               |
| [Back]                       |
---------------------------------
Display a scrollable list of at least 5 app review guidelines as text items.
Use a navigation bar with the title 'App Review Guidelines'.
Add a Back button on the navigation bar that dismisses the screen.
Ensure the text is readable with good contrast and padding.
Support both light and dark mode automatically.
Starter Code
iOS Swift
import SwiftUI

struct AppReviewGuidelinesView: View {
    var body: some View {
        NavigationView {
            // TODO: Add scrollable list of guidelines here
            Text("Placeholder for guidelines list")
                .navigationTitle("App Review Guidelines")
                .navigationBarTitleDisplayMode(.inline)
                // TODO: Add Back button functionality
        }
    }
}

struct AppReviewGuidelinesView_Previews: PreviewProvider {
    static var previews: some View {
        AppReviewGuidelinesView()
    }
}
Task 1
Task 2
Task 3
Task 4
Solution
iOS Swift
import SwiftUI

struct AppReviewGuidelinesView: View {
    @Environment(\.presentationMode) var presentationMode

    let guidelines = [
        "1. Follow Apple's content rules",
        "2. Ensure app stability",
        "3. Use proper user interface",
        "4. Respect user privacy",
        "5. Provide accurate metadata"
    ]

    var body: some View {
        NavigationView {
            ScrollView {
                VStack(alignment: .leading, spacing: 16) {
                    ForEach(guidelines, id: \.self) { guideline in
                        Text(guideline)
                            .font(.body)
                            .foregroundColor(Color.primary)
                    }
                }
                .padding()
            }
            .navigationTitle("App Review Guidelines")
            .navigationBarTitleDisplayMode(.inline)
            .toolbar {
                ToolbarItem(placement: .navigationBarLeading) {
                    Button(action: {
                        presentationMode.wrappedValue.dismiss()
                    }) {
                        Text("Back")
                    }
                    .accessibilityLabel("Back button")
                }
            }
        }
    }
}

struct AppReviewGuidelinesView_Previews: PreviewProvider {
    static var previews: some View {
        Group {
            AppReviewGuidelinesView()
                .preferredColorScheme(.light)
            AppReviewGuidelinesView()
                .preferredColorScheme(.dark)
        }
    }
}

This screen uses a NavigationView to provide a navigation bar with the title and a Back button. The guidelines are shown inside a ScrollView with a vertical stack (VStack) of text items. Padding and spacing make the text easy to read. The Back button uses the presentationMode environment variable to dismiss the view when tapped. Colors automatically adapt to light and dark mode by using Color.primary for text. Accessibility label is added for the Back button for screen readers.

Final Result
Completed Screen
---------------------------------
| App Review Guidelines          |
|-------------------------------|
| 1. Follow Apple's content rules|
|                               |
| 2. Ensure app stability        |
|                               |
| 3. Use proper user interface   |
|                               |
| 4. Respect user privacy        |
|                               |
| 5. Provide accurate metadata   |
|                               |
| [Back]                       |
---------------------------------
User can scroll vertically to read all guidelines if screen is small.
Tapping the Back button closes the guidelines screen and returns to the previous screen.
Stretch Goal
Add a search bar at the top to filter the guidelines by keywords.
💡 Hint
Use a @State variable to hold the search text and filter the guidelines array dynamically in the view.