How to Build an iOS App with Next.js in 2025
Turn your Next.js web app into a native iOS application using Capacitor. This step-by-step guide covers everything from initial setup to publishing on the App Store.
📋 Prerequisites
- Next.js project ready
- macOS computer (required for iOS development)
- Xcode installed from Mac App Store
- Apple Developer account ($99/year)
🎯 What You'll Learn
- Configure Next.js for iOS development
- Set up Capacitor for iOS
- Build and run your app in iOS Simulator
- Add iOS-specific features
- Prepare for App Store submission
Step-by-Step Guide
Install Xcode and Command Line Tools
# Verify installation
xcode-select -p
# Install command line tools if not already installed
xcode-select --install
Xcode is required for iOS development and can only run on macOS.
Configure Next.js for Static Export
iOS apps need static files. Configure Next.js to export a static site.
const nextConfig = {
// Export statically for native builds
...(process.env.IS_NATIVE && {
env: {
IS_NATIVE: "true",
},
output: "export",
images: {
unoptimized: true,
},
}),
};
export default nextConfig;Update package.json scripts
Add scripts to build and open the iOS project easily in dev mode.
"mobile": "cross-env IS_NATIVE=true npm run build && cross-env IS_NATIVE=true npx cap sync",
"mobile:dev": "cross-env IS_NATIVE=true npm run build && cross-env IS_NATIVE=true npx cap sync && npm run dev"Install and Initialize Capacitor
Add Capacitor to your Next.js project and configure it for iOS.
npm install @capacitor/core @capacitor/cli @capacitor/ios
npx cap initWhen prompted, enter your app name and bundle ID (e.g., com.yourcompany.appname).
Update Capacitor Config
Configure Capacitor to use the correct build directory.
import { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
appId: 'com.yourcompany.appname',
appName: 'Your App Name',
webDir: 'out',
ios: {
schema: 'YourAppName',
}
};
export default config;Add iOS Platform
Add the iOS platform to your project. This creates an ios folder with an Xcode project.
npx cap add iosBuild Your Next.js App
Build your Next.js app and sync it with the iOS project.
npm run build
npx cap sync iosRun 'npx cap sync ios' every time you update your web code.
Open in Xcode
Open your iOS project in Xcode to configure signing and build settings.
npx cap open iosConfigure Signing in Xcode
Run on iOS Simulator
First launch can take a few minutes. Subsequent launches are lighting-fast.
Test on a Real Device
Go to Settings → General → VPN & Device Management to trust the certificate.
Ready to Build Your Mobile App?
Get NextNative and start converting your Next.js website to a mobile app in minutes.
Related Tutorials
How to Convert Your Next.js App to iOS & Android
Learn how to transform your Next.js web application into fully functional iOS and Android mobile apps using Capacitor. This guide covers installation, configuration, and deployment to app stores.
How to Deploy Your Next.js App to the App Store
Learn how to prepare, build, and submit your Next.js mobile app to the Apple App Store. This guide covers everything from app icons to App Store Connect configuration.
Compare Mobile Frameworks
Still deciding on your tech stack? Check out these comparisons
📚 Ship mobile apps faster
Explore detailed documentation to see features and shortcuts NextNative gives you to ship mobile apps faster.
📖 Full Documentation
Complete guides, API references, and best practices for building mobile apps with NextNative.
🚀 Quick Start Guide
Get your app up and running in just 5 minutes with our quick start tutorial.
🔔 Push Notifications
Learn how to set up and customize push notifications for your mobile app.
💰 In-App Purchases
Implement monetization with in-app purchases using RevenueCat integration.