A native iOS application built with Swift & SwiftUI that lets users pick any file from their device and upload it to the cloud via the Cloudinary API.
┌──────────────────────────┐
│ 📂 Select a File │
│ │
│ FileName.pdf │
│ Status: Uploading... │
│ │
│ [ Upload to Cloud ] │
│ │
│ ✅ https://res.cloud.. │
└──────────────────────────┘
DevSphere-App-iOS-Hard/
├── Config/
│ └── CloudinaryConfig.plist # 🔑 Add your cloud name & upload preset here
├── Views/
│ └── ContentView.swift # 🖼️ Main SwiftUI UI
├── Logic/
│ ├── FilePickerLogic.swift # 📂 File selection handler
│ └── CloudinaryUploader.swift # ☁️ Upload function
└── README.md
git clone https://github.com/Google-Developers-Group-IIIT-Lucknow/DevSphere-App-iOS-Hard.git
cd DevSphere-App-iOS-Hard- Open Xcode
- Click Open a Project or File
- Select the cloned folder
- Wait for Swift Package Manager to resolve dependencies
- Go to cloudinary.com and sign up (free tier is enough)
- From your Dashboard, copy your Cloud Name
- Go to Settings → Upload → Upload Presets
- Create an unsigned upload preset and copy its name
Open Config/CloudinaryConfig.plist and replace the placeholder values:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLOUDINARY_CLOUD_NAME</key>
<string>your_cloud_name</string> <!-- ✏️ Replace this -->
<key>CLOUDINARY_UPLOAD_PRESET</key>
<string>your_upload_preset</string> <!-- ✏️ Replace this -->
</dict>
</plist>
⚠️ Do NOT commit real credentials to a public repository. AddCloudinaryConfig.plistto.gitignoreor use environment variables for production.
Handle the result of the document picker:
Requirements:
- ✅ Handle empty/cancelled selection gracefully
- ✅ Store
fileNameandfileURLin state - ✅ Update status label after selection
| Property | Value |
|---|---|
| Endpoint | https://api.cloudinary.com/v1_1/{cloud_name}/auto/upload |
| Method | POST |
| Body Type | multipart/form-data |
| Required Fields | upload_preset, file |
| Response Key | secure_url — the public URL of the uploaded file |
| Feature | Description |
|---|---|
| ☐ File Selection | Works via UIDocumentPickerViewController for any file type |
| ☐ Security Scoped Resources | Proper startAccessingSecurityScopedResource / defer usage |
| ☐ Multipart Request | Correctly structured multipart/form-data body |
| ☐ API Call | POST to Cloudinary endpoint using URLSession |
| ☐ Response Parsing | Extracts secure_url from JSON response |
| ☐ Status Messages | Shows Uploading…, ✅ Success, or ❌ Error in the UI |
| ☐ Error Handling | Handles file read errors, network errors, and bad responses |
| ☐ No Crashes | App handles nil/invalid input without crashing |
- Run the app on a real device or simulator
- Tap Select File → choose any file (PDF, image, text, etc.)
- Tap Upload to Cloud
- Verify:
- Status changes to
Uploading... - On success, a
https://res.cloudinary.com/...URL appears - Log into your Cloudinary dashboard to confirm the file is there
- Status changes to
- Use an unsigned upload preset for this project (no API secret needed)
- The
/auto/uploadendpoint automatically detects file type secure_urlin the response always uses HTTPS- Security-scoped resources must be released with
stopAccessingSecurityScopedResource()
- Fork the repo
- Create your branch:
git checkout -b feature/your-feature - Commit changes:
git commit -m "feat: add your feature" - Push:
git push origin feature/your-feature - Open a Pull Request