Skip to content

iOSBrowserOptionsBuilder

Fluent builder for iOSBrowserOptions. Options not configured use the system default.

Kodster.InAppWebBrowser.iOS.iOSBrowserOptionsBuilder

Overview

iOSBrowserOptionsBuilder provides a chainable API for configuring iOSBrowserOptions. Each With* method returns the same builder instance for fluent chaining. Call Build() to create the final iOSBrowserOptions object.

Example

#if UNITY_IOS
var options = new iOSBrowserOptionsBuilder()
    .WithColorScheme(iOSColorScheme.Dark)
    .WithDismissButtonStyle(DismissButtonStyle.Close)
    .WithPresentationStyle(PresentationStyle.PageSheet)
    .Build();

iOSBrowser.Open("https://example.com", options);
#endif

Methods

WithReaderModeEnabled

public iOSBrowserOptionsBuilder WithReaderModeEnabled(
    bool readerModeEnabled
)

Sets whether the browser presents the page in Reader Mode.

Parameters

  • readerModeEnabled (bool): true to enable Reader Mode when available.

Returns

  • The current iOSBrowserOptionsBuilder instance.

WithBarCollapsingEnabled

public iOSBrowserOptionsBuilder WithBarCollapsingEnabled(
    bool barCollapsingEnabled
)

Sets whether the toolbar collapses as the user scrolls.

Parameters

  • barCollapsingEnabled (bool): true to enable bar collapsing.

Returns

  • The current iOSBrowserOptionsBuilder instance.

Remarks

  • Not available on iOS 26 or later.

WithDismissButtonStyle

public iOSBrowserOptionsBuilder WithDismissButtonStyle(
    DismissButtonStyle dismissButtonStyle
)

Sets the label or icon shown on the Dismiss button.

Parameters

  • dismissButtonStyle (DismissButtonStyle): The desired Dismiss button style.

Returns

  • The current iOSBrowserOptionsBuilder instance.

WithPresentationStyle

public iOSBrowserOptionsBuilder WithPresentationStyle(
    PresentationStyle presentationStyle
)

Sets the way the browser is presented.

Parameters

  • presentationStyle (PresentationStyle): The desired presentation style.

Returns

  • The current iOSBrowserOptionsBuilder instance.

WithOpenInExternalHandlerEnabled

public iOSBrowserOptionsBuilder WithOpenInExternalHandlerEnabled(
    bool openInExternalHandlerEnabled
)

Sets whether URLs that can be handled by an external app are opened there instead of in-app.

Parameters

  • openInExternalHandlerEnabled (bool): true to route matching URLs to external apps.

Returns

  • The current iOSBrowserOptionsBuilder instance.

WithColorScheme

public iOSBrowserOptionsBuilder WithColorScheme(
    iOSColorScheme colorScheme
)

Sets the color scheme used for the browser UI.

Parameters

  • colorScheme (iOSColorScheme): The desired color scheme.

Returns

  • The current iOSBrowserOptionsBuilder instance.

WithInteractiveDismissEnabled

public iOSBrowserOptionsBuilder WithInteractiveDismissEnabled(
    bool interactiveDismissEnabled
)

Sets whether the user can dismiss the browser by tapping the app behind it.

Parameters

  • interactiveDismissEnabled (bool): true to allow tap-behind dismissal.

Returns

  • The current iOSBrowserOptionsBuilder instance.

WithPreferredContentSize

public iOSBrowserOptionsBuilder WithPreferredContentSize(
    Vector2 preferredContentSize
)

Sets the preferred width and height of the browser content, in points, used in a form-sheet. Negative values are clamped to 0.

Parameters

  • preferredContentSize (Vector2): Preferred width (x) and height (y) in points.

Returns

  • The current iOSBrowserOptionsBuilder instance.

WithAnimationEnabled

public iOSBrowserOptionsBuilder WithAnimationEnabled(
    bool animationEnabled
)

Sets whether presentation and dismissal are animated.

Parameters

  • animationEnabled (bool): true to animate presentation and dismissal.

Returns

  • The current iOSBrowserOptionsBuilder instance.

WithInitialHeightPercent

public iOSBrowserOptionsBuilder WithInitialHeightPercent(
    int initialHeightPercent
)

Sets the initial height of the browser as a percentage of available screen height. Clamped to 0100.

Parameters

  • initialHeightPercent (int): Initial height as a percentage of available screen height.

Returns

  • The current iOSBrowserOptionsBuilder instance.

WithExpansionEnabled

public iOSBrowserOptionsBuilder WithExpansionEnabled(
    bool expansionEnabled
)

Sets whether the browser can be expanded to full height.

Parameters

  • expansionEnabled (bool): true to allow expansion to full height.

Returns

  • The current iOSBrowserOptionsBuilder instance.

WithBackgroundInteractionEnabled

public iOSBrowserOptionsBuilder WithBackgroundInteractionEnabled(
    bool backgroundInteractionEnabled
)

Sets whether the content behind the browser receives touch input.

Parameters

  • backgroundInteractionEnabled (bool): true to allow background interaction.

Returns

  • The current iOSBrowserOptionsBuilder instance.

WithGrabberVisible

public iOSBrowserOptionsBuilder WithGrabberVisible(
    bool grabberVisible
)

Sets whether the grabber handle is shown at the top of the browser.

Parameters

  • grabberVisible (bool): true to show the grabber handle.

Returns

  • The current iOSBrowserOptionsBuilder instance.

WithSheetCornerRadius

public iOSBrowserOptionsBuilder WithSheetCornerRadius(
    float sheetCornerRadius
)

Sets the corner radius of the browser, in points. Negative values are clamped to 0.

Parameters

  • sheetCornerRadius (float): Corner radius in points.

Returns

  • The current iOSBrowserOptionsBuilder instance.

WithExpandOnScrollEnabled

public iOSBrowserOptionsBuilder WithExpandOnScrollEnabled(
    bool expandOnScrollEnabled
)

Sets whether scrolling content expands the browser to full height.

Parameters

  • expandOnScrollEnabled (bool): true to expand on scroll.

Returns

  • The current iOSBrowserOptionsBuilder instance.

WithKeepSheetInLandscapeEnabled

public iOSBrowserOptionsBuilder WithKeepSheetInLandscapeEnabled(
    bool keepSheetInLandscapeEnabled
)

Sets whether the browser remains a sheet in landscape orientation instead of going full-screen.

Parameters

  • keepSheetInLandscapeEnabled (bool): true to keep sheet presentation in landscape.

Returns

  • The current iOSBrowserOptionsBuilder instance.

WithTransitionStyle

public iOSBrowserOptionsBuilder WithTransitionStyle(
    TransitionStyle transitionStyle
)

Sets the animation style used when presenting the browser modally.

Parameters

  • transitionStyle (TransitionStyle): The desired transition style.

Returns

  • The current iOSBrowserOptionsBuilder instance.

Build

public iOSBrowserOptions Build()

Builds and returns an iOSBrowserOptions instance from the current configuration. Only options explicitly set via the With* methods are included; unset options remain null.

Returns

  • A new iOSBrowserOptions instance reflecting the builder's current state.