Skip to content

Commit 1a0b849

Browse files
docs: initial version of super-capacitor docs
1 parent 7bc5258 commit 1a0b849

File tree

7 files changed

+303
-144
lines changed

7 files changed

+303
-144
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Overview
2+
3+
Super Capacitor is a Capacitor plugin designed to allow Capacitor apps to utilize the capabilities of Ionic Portals.
4+
5+
## Install
6+
7+
```bash
8+
npm install @ionic-enterprise/super-capacitor
9+
npx cap sync
10+
```
11+
12+
## Types
13+
14+
### PortalOptions
15+
16+
The options for configuring your portal when using [`presentPortal`](#presentportal).
17+
18+
```typescript
19+
interface PortalOptions {
20+
name: string;
21+
startDir?: string;
22+
initialContext?: InitialContext;
23+
plugins?: CapacitorPlugin[];
24+
liveUpdateConfig?: LiveUpdateConfig;
25+
type: 'push' | 'modal';
26+
modalStyle?: 'fullscreen' | 'sheet';
27+
}
28+
```
29+
30+
### CapacitorPlugin
31+
32+
If you need to use any Capacitor plugins, the classpath of the Android plugins and the Objective-C class name will have to be provided to [`PortalOptions`](#portaloptions) in the `plugins` property.
33+
34+
```typescript
35+
interface CapacitorPlugin {
36+
/** The classpath of the plugin to be used in Android. (e.g. com.capacitorjs.plugins.camera.CameraPlugin) */
37+
androidClassPath: string;
38+
/** The class name of the plugin to be used in iOS.
39+
* This must be the name as it is exposed to the Objective-C runtime.
40+
* For example, The CameraPlugin swift class is exposed to Objective-C as CAPCameraPlugin.
41+
*/
42+
iosClassName: string;
43+
}
44+
```
45+
46+
## Methods
47+
48+
- [`presentPortal(options: PortalOptions)`](#presentportal)
49+
- [`dismissPortal()`](#dismissportal)
50+
51+
### presentPortal
52+
53+
```typescript
54+
presentPortal(options: PortalOptions) => Promise<void>
55+
```
56+
57+
#### Usage
58+
59+
```typescript
60+
import { presentPortal } from '@ionic-enterprise/super-capacitor/superapp';
61+
62+
presentPortal({ name: 'checkoutApp', startDir: 'portals/checkout', type: 'push' });
63+
```
64+
65+
#### Parameters
66+
67+
| Name | Type | Description |
68+
| --------- | ------------------------------- | ------------------------------------------------------------------- |
69+
| `options` | [`PortalOptions`](#portaloptions) | The [`PortalOptions`](#portaloptions) object to configure the portal. |
70+
71+
### dismissPortal
72+
73+
```typescript
74+
dismissPortal() => Promise<void>
75+
```
76+
77+
#### Usage
78+
79+
```typescript
80+
import { dismissPortal } from '@ionic-enterprise/super-capacitor/miniapp';
81+
82+
dismissPortal();
83+
```
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import useBaseUrl from '@docusaurus/useBaseUrl';
2+
3+
# Connecting a Root Navigation Controller in Swift Using Storyboard
4+
5+
By default, Capacitor apps are embedded in a `CAPBridgeViewController`. To utilize the "push" type for presenting portals, it is necessary to embed the app within a navigation controller.
6+
7+
## Step 1: Open the Main Storyboard
8+
9+
1. In the project navigator, locate and open the `Main.storyboard` file.
10+
11+
<em
12+
style={{
13+
textAlign: 'center',
14+
display: 'block',
15+
}}
16+
>
17+
<img
18+
src={useBaseUrl('/img/super-capacitor/embed-nav-controller-tutorial/step-1.webp')}
19+
data-zoom-src={useBaseUrl('/img/super-capacitor/embed-nav-controller-tutorial/step-1.webp')}
20+
width="75%"
21+
/>
22+
</em>
23+
24+
## Step 2: Add a Navigation Controller
25+
26+
1. Drag and drop a "Navigation Controller" from the Object Library onto the storyboard canvas.
27+
28+
<em
29+
style={{
30+
textAlign: 'center',
31+
display: 'block',
32+
}}
33+
>
34+
<img
35+
src={useBaseUrl('/img/super-capacitor/embed-nav-controller-tutorial/step-2.webp')}
36+
data-zoom-src={useBaseUrl('/img/super-capacitor/embed-nav-controller-tutorial/step-2.webp')}
37+
width="75%"
38+
/>
39+
</em>
40+
41+
2. The navigation controller will come with an attached view controller. Remove the attached view controller and add a root view controller seugue from the navigation controller to the bridge view controller.
42+
43+
<em
44+
style={{
45+
textAlign: 'center',
46+
display: 'block',
47+
}}
48+
>
49+
<img
50+
src={useBaseUrl('/img/super-capacitor/embed-nav-controller-tutorial/step-2-1.webp')}
51+
data-zoom-src={useBaseUrl('/img/super-capacitor/embed-nav-controller-tutorial/step-2-1.webp')}
52+
width="75%"
53+
/>
54+
</em>
55+
56+
## Step 3: Set the Initial View Controller
57+
58+
1. Set the navigation controller as the initial view controller.
59+
60+
<em
61+
style={{
62+
textAlign: 'center',
63+
display: 'block',
64+
}}
65+
>
66+
<img
67+
src={useBaseUrl('/img/super-capacitor/embed-nav-controller-tutorial/step-3.webp')}
68+
data-zoom-src={useBaseUrl('/img/super-capacitor/embed-nav-controller-tutorial/step-3.webp')}
69+
width="75%"
70+
/>
71+
</em>
72+
73+
## Step 4: Customize the Navigation Controller
74+
75+
1. To remove the navigation bar, set "Top Bar" to "None" in the Simulated Metrics section of the navigation controller.

0 commit comments

Comments
 (0)