Skip to content

Add SwiftUI upload example; consolidate apps under examples/ - #3

Open
rohit-fastpix wants to merge 1 commit into
mainfrom
feat/swiftui-example
Open

Add SwiftUI upload example; consolidate apps under examples/#3
rohit-fastpix wants to merge 1 commit into
mainfrom
feat/swiftui-example

Conversation

@rohit-fastpix

Copy link
Copy Markdown
Collaborator

FastPix iOS Uploads SDK - Documentation PR

Documentation Changes

  • New documentation added
  • Existing documentation updated
  • Documentation errors fixed
  • Code examples updated
  • Links and references updated

Files Modified

  • README.md
  • docs/ directory
  • USAGE.md
  • CONTRIBUTING.md
  • Other: new SwiftUI example app + examples/ reorg (examples/README.md,
    examples/swiftui/**, examples/BACKGROUND-UPLOADS-SDK-REQUEST.md), UIKit
    example moved to examples/uikit/

Summary

Brief description of changes:

Adds a SwiftUI example app demonstrating the iOS Uploads SDK, and consolidates
the example apps under a single examples/ folder (one folder per project).

  • New examples/swiftui/ — a SwiftUI app that mints a signed upload URL
    in-app (create-upload), picks a video via PhotosPicker, and drives chunked
    upload with live progress and pause / resume / cancel through an
    ObservableObject. References the SDK locally so it builds against this repo.
  • Background uploads — wraps the active upload in beginBackgroundTask
    (best-effort). True background continuation needs a background URLSession,
    which is an SDK change; documented in BACKGROUND-UPLOADS-SDK-REQUEST.md.
  • Reorg — the existing UIKit example moved from example/ to
    examples/uikit/ (history preserved); added a minimal examples/README.md.
  • Credentials are read from a gitignored Secrets.swift (template committed as
    Secrets.example.swift); no keys are committed.

Code Examples

import fp_swift_upload_sdk

// Keep a strong reference for the whole upload session.
let uploader = Uploads()
uploader.delegate = self          // UploadsDelegate — progress + lifecycle events

// Mint a signed upload URL, then start the chunked upload.
Task {
    let signed = try await FastPixAPI.createUpload()   // POST /v1/on-demand/upload
    uploader.uploadFile(file: fileURL, endpoint: signed.url)
}

// Manage upload lifecycle.
uploader.pause()   // Pause upload
uploader.resume()  // Resume upload
uploader.abort()   // Abort upload

Testing

  • All code examples tested on iOS
  • Links verified
  • Grammar checked
  • Formatting consistent

Notes: SwiftUI example builds clean against the local SDK (iOS 16+
simulator); create-upload verified against the live API (HTTP 201, returns
data.url + data.uploadId).


Review Checklist

  • Content is accurate
  • Code examples work as expected
  • Links are working
  • Grammar is correct
  • Formatting is consistent

Ready for review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant