Skip to content

Quick Start

Athar Reza edited this page Nov 1, 2025 · 1 revision

๐Ÿš€ Quick Start Guide

Get up and running with AgriSense iOS development in just 5 minutes!


โšก Prerequisites Check

Before starting, ensure you have:

  • โœ… macOS 13.0+ installed
  • โœ… Xcode 15.0+ installed
  • โœ… Git installed
  • โœ… GitHub account (for cloning)

Don't have these? โ†’ See Installation Guide


๐ŸŽฏ 5-Minute Setup

Step 1: Clone Repository (1 min)

# Clone the repository
git clone https://github.com/Athar891/AgrisenseiOS.git

# Navigate to directory
cd AgrisenseiOS

Step 2: Open in Xcode (1 min)

# Open project
open Agrisense.xcodeproj

Wait for Xcode to:

  • Load project
  • Index files
  • Resolve Swift packages (automatic)

Step 3: Quick Firebase Setup (2 min)

  1. Get Firebase Config:

    • Visit Firebase Console
    • Use existing project or create new one
    • Download GoogleService-Info.plist
  2. Add to Project:

    # Copy to Agrisense folder
    cp ~/Downloads/GoogleService-Info.plist ./Agrisense/
  3. Verify in Xcode:

    • File should appear in Agrisense folder
    • Target membership: Agrisense โœ…

Step 4: Add API Keys (1 min)

Create Secrets.swift in Agrisense/Models/:

import Foundation

enum Secrets {
    static let weatherAPIKey = "YOUR_KEY_HERE"  // Get from openweathermap.org
    static let geminiAPIKey = "YOUR_KEY_HERE"   // Get from ai.google.dev
    static let cloudinaryCloudName = "YOUR_CLOUD_NAME"
    static let cloudinaryUploadPreset = "YOUR_PRESET"
}

Quick API Keys (Optional for first run):

Step 5: Build & Run (30 sec)

  1. Select target: Agrisense
  2. Select device: iPhone 14 Pro (or any simulator)
  3. Press โŒ˜R (Command + R)
  4. Wait for build... โณ
  5. App launches! ๐ŸŽ‰

๐ŸŽฎ First Run

What You'll See

  1. Splash Screen - AgriSense logo
  2. Welcome Screen - App introduction
  3. Sign In/Sign Up - Authentication screen

Create Test Account

Email: test@agrisense.com
Password: TestPassword123!

Or use Google Sign-In for faster setup.


๐Ÿงญ Quick Tour

Main Features to Explore

1. Dashboard (Home) ๐Ÿ 

  • Weather information
  • Market prices
  • Quick actions

2. AI Assistant ๐Ÿค–

  • Tap microphone icon
  • Say "Krishi AI" to activate
  • Ask a question about farming

3. Crop Management ๐ŸŒฑ

  • Tap "Add Crop" button
  • Fill in crop details
  • View your crop portfolio

4. Marketplace ๐Ÿ›’

  • Browse products
  • Add to cart
  • Checkout flow

๐Ÿ’ป Development Workflow

Making Changes

# Create feature branch
git checkout -b feature/my-new-feature

# Make your changes in Xcode

# Build and test
โŒ˜B  # Build
โŒ˜R  # Run
โŒ˜U  # Test

# Commit changes
git add .
git commit -m "Add: my new feature"

# Push to GitHub
git push origin feature/my-new-feature

Testing Your Changes

# Run unit tests
โŒ˜U

# Or via command line
xcodebuild test \
  -project Agrisense.xcodeproj \
  -scheme Agrisense \
  -destination 'platform=iOS Simulator,name=iPhone 14 Pro'

๐ŸŽจ Quick Customization

Change App Theme

// Agrisense/Models/AppState.swift
@Published var isDarkMode = true  // Change to true for dark mode

Change Default Language

// Agrisense/CoreKit/LocalizationManager.swift
@Published var currentLanguage = "hi"  // "hi" for Hindi, "en" for English

Modify AI Assistant Voice

// Agrisense/Services/EnhancedTTSService.swift
utterance.rate = 0.6        // Speed (0.0 - 1.0)
utterance.pitchMultiplier = 1.2  // Pitch (0.5 - 2.0)

๐Ÿ”ง Common Tasks

Add New View

  1. Create SwiftUI View:

    // Agrisense/Views/MyNewView.swift
    import SwiftUI
    
    struct MyNewView: View {
        var body: some View {
            Text("Hello, AgriSense!")
        }
    }
  2. Add to Navigation:

    // In parent view
    NavigationLink("Go to My View") {
        MyNewView()
    }

Add New Model

// Agrisense/Models/MyModel.swift
import Foundation

struct MyModel: Identifiable, Codable {
    let id: String
    var name: String
    var createdAt: Date
}

Add New Service

// Agrisense/Services/MyService.swift
import Foundation

class MyService: ObservableObject {
    @Published var data: [MyModel] = []
    
    func fetchData() async throws {
        // Fetch logic here
    }
}

๐Ÿ“ฑ Test on Real Device

Setup

  1. Connect iPhone via USB
  2. Trust Computer (on device)
  3. Enable Developer Mode:
    • Settings โ†’ Privacy & Security โ†’ Developer Mode โ†’ ON
  4. Select Device in Xcode
  5. Build & Run (โŒ˜R)

First Time Setup

  • Xcode will register device automatically
  • May need to verify in Settings โ†’ General โ†’ VPN & Device Management

๐Ÿ› Quick Fixes

Build Fails?

# Clean build folder
โŒ˜โ‡งK

# Clear derived data
rm -rf ~/Library/Developer/Xcode/DerivedData/*

# Rebuild
โŒ˜B

Packages Won't Resolve?

# In Xcode menu
File โ†’ Packages โ†’ Reset Package Caches
File โ†’ Packages โ†’ Resolve Package Versions

Simulator Issues?

# Reset simulator
xcrun simctl erase all

# Restart simulator
killall Simulator

Firebase Connection Issues?

  1. Check GoogleService-Info.plist is present
  2. Verify bundle ID matches Firebase config
  3. Check internet connection
  4. Look for errors in console

๐Ÿ“– What's Next?

Learn the Architecture

Explore Features

Start Contributing


๐Ÿ’ก Pro Tips

Xcode Shortcuts

โŒ˜B         Build
โŒ˜R         Run
โŒ˜.         Stop
โŒ˜U         Test
โŒ˜โ‡งK        Clean
โŒ˜โ‡งY        Show/Hide Console
โŒ˜โ‡งO        Quick Open
โŒ˜โŒฅJ        Jump to Definition
โŒ˜/         Comment/Uncomment

Debugging

po variableName           Print object in console
p variableName            Print value
expr variableName = value Modify at runtime

Simulator Controls

โŒ˜K         Toggle keyboard
โŒ˜โ†’         Rotate right
โŒ˜โ†         Rotate left
โŒ˜โ‡งH        Home button
โŒ˜โ‡งH (2x)   App switcher

๐ŸŽฏ Challenge: Your First Feature

Goal: Add a "Hello Farmer" Banner

Time: ~10 minutes

Steps:

  1. Open DashboardView.swift

    # Quick open in Xcode
    โŒ˜โ‡งO โ†’ Type "DashboardView" โ†’ Enter
  2. Add Banner at Top

    var body: some View {
        VStack {
            // Add this
            Text("๐Ÿ‘‹ Hello, Farmer!")
                .font(.largeTitle)
                .padding()
                .background(Color.green.opacity(0.2))
                .cornerRadius(10)
            
            // Existing content...
        }
    }
  3. Build & Run (โŒ˜R)

  4. See Your Changes! ๐ŸŽ‰

Bonus: Make it personalized:

Text("๐Ÿ‘‹ Hello, \(userManager.currentUser?.name ?? "Farmer")!")

๐Ÿ“ž Need Help?

Resources

Community

  • ๐Ÿ’ฌ Join discussions
  • ๐Ÿค Connect with contributors
  • ๐Ÿ“ง Email: support@agrisense.app

โœ… Checklist

Before moving forward, ensure:

  • Project builds successfully
  • App runs on simulator
  • Firebase connected
  • Can create test account
  • All main tabs accessible
  • No console errors (warnings OK)

Ready to dive deeper? โ†’ Project Architecture

Want to contribute? โ†’ Contributing Guide

Need setup help? โ†’ Installation Guide


Happy Coding! ๐Ÿš€

Made with โค๏ธ for AgriSense

Clone this wiki locally