{
"dependencies": {
"com.candycoded.unity-ios-bridge": "https://github.com/CandyCoded/Unity-iOS-Bridge.git#v1.1.0"
}
}
Make your apps accessible to everyone, including people with disabilities.
https://developer.apple.com/documentation/uikit/accessibility?language=objc
Returns a Boolean value indicating whether the system preference for AssistiveTouch is enabled.
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.Accessibility.IOSUIAccessibilityIsAssistiveTouchRunning()); // true
#endif
Returns a Boolean value indicating whether VoiceOver is running.
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.Accessibility.IOSUIAccessibilityIsVoiceOverRunning()); // true
#endif
Returns a Boolean value indicating whether Switch Control is enabled.
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.Accessibility.IOSUIAccessibilityIsSwitchControlRunning()); // true
#endif
Returns a Boolean value indicating whether the system preference for Shake to Undo is enabled.
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.Accessibility.IOSUIAccessibilityIsShakeToUndoEnabled()); // true
#endif
Returns a Boolean value indicating whether closed captioning is enabled.
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.Accessibility.IOSUIAccessibilityIsClosedCaptioningEnabled()); // true
#endif
Returns a Boolean value indicating whether bold text is enabled.
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.Accessibility.IOSUIAccessibilityIsBoldTextEnabled()); // true
#endif
Returns a Boolean value indicating whether darken colors is enabled.
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.Accessibility.IOSUIAccessibilityDarkerSystemColorsEnabled()); // true
#endif
Returns a Boolean value indicating whether grayscale is enabled.
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.Accessibility.IOSUIAccessibilityIsGrayscaleEnabled()); // true
#endif
Returns a Boolean value indicating whether the app is running in Guided Access mode.
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.Accessibility.IOSUIAccessibilityIsGuidedAccessEnabled()); // true
#endif
Returns a Boolean value indicating whether inverted colors is enabled.
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.Accessibility.IOSUIAccessibilityIsInvertColorsEnabled()); // true
#endif
Returns a Boolean value indicating whether system audio is set to mono.
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.Accessibility.IOSUIAccessibilityIsMonoAudioEnabled()); // true
#endif
Returns a Boolean value indicating whether reduce motion is enabled.
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.Accessibility.IOSUIAccessibilityIsReduceMotionEnabled()); // true
#endif
Returns a Boolean value indicating whether reduce transparency is enabled.
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.Accessibility.IOSUIAccessibilityIsReduceTransparencyEnabled()); // true
#endif
Returns a Boolean value indicating whether speaking the screen is enabled.
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.Accessibility.IOSUIAccessibilityIsSpeakScreenEnabled()); // true
#endif
Returns a Boolean value indicating whether speaking the selection is enabled.
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.Accessibility.IOSUIAccessibilityIsSpeakSelectionEnabled()); // true
#endif
#if UNITY_IOS && !UNITY_EDITOR
CandyCoded.UnityIOSBridge.Alert.IOSUIAlertController("Title", "message", () => { Debug.Log("OK"); });
#endif
#if UNITY_IOS && !UNITY_EDITOR
CandyCoded.UnityIOSBridge.Alert.IOSUIAlertController("Title", "message", () => { Debug.Log("OK"); }, () => { Debug.Log("Cancel"); });
#endif
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.Permission.IOSPermissionCameraOK()); // true
#endif
Ref: https://developer.apple.com/documentation/avfoundation/avauthorizationstatus?language=objc
Note: This requires NSPhotoLibraryAddUsageDescription
to be in the Info.plist
file with a value.
Note: Screenshot.Save
uses the internal method ScreenCapture.CaptureScreenshot
which returns before the file is saved to the device. Make sure the file exists before calling IOSImageAddToGallery
by using a coroutine to wait until the file exists.
public void TakeScreenshot()
{
StartCoroutine(TakeScreenshotCoroutine());
}
private static IEnumerator TakeScreenshotCoroutine()
{
var screenshotFilePath = Screenshot.Save();
Debug.Log($"Saved screenshot to {screenshotFilePath}");
while (!File.Exists(screenshotFilePath))
{
yield return null;
}
yield return new WaitForEndOfFrame();
#if UNITY_IOS && !UNITY_EDITOR
CandyCoded.UnityIOSBridge.Photos.IOSImageAddToGallery(screenshotFilePath);
Debug.Log("Saved to gallery.");
#endif
}
Ref: https://developer.apple.com/documentation/bundleresources/information_property_list/nsphotolibraryaddusagedescription?language=objc Ref: https://developer.apple.com/documentation/bundleresources/information_property_list/uifilesharingenabled?language=objc
A Boolean indicating whether Low Power Mode is enabled on an iOS device.
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.Settings.IOSIsLowPowerModeEnabled()); // false
#endif
#if UNITY_IOS && !UNITY_EDITOR
CandyCoded.UnityIOSBridge.Settings.IOSUIImpactFeedbackGenerator();
#endif
#if UNITY_IOS && !UNITY_EDITOR
CandyCoded.UnityIOSBridge.Settings.IOSUIImpactFeedbackGenerator("light");
CandyCoded.UnityIOSBridge.Settings.IOSUIImpactFeedbackGenerator("medium");
CandyCoded.UnityIOSBridge.Settings.IOSUIImpactFeedbackGenerator("heavy");
#endif
Ref: https://developer.apple.com/documentation/uikit/uiimpactfeedbackgenerator?language=objc
The insets that you use to determine the safe area for this view.
#if UNITY_IOS && !UNITY_EDITOR
Debug.Log(CandyCoded.UnityIOSBridge.View.IOSSafeAreaInsets()); // {top: 0, left: 0, right: 0, bottom: 0}
#endif
Ref: https://developer.apple.com/documentation/uikit/uiview/2891103-safeareainsets?language=objc