├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── NOTICE ├── Package.swift ├── README.md ├── Samples ├── CameraKitAlternateCarouselSample │ ├── .gitignore │ ├── CameraKitAlternateCarouselSample.xcodeproj │ │ └── project.pbxproj │ ├── CameraKitAlternateCarouselSample │ │ ├── AppDelegate.swift │ │ ├── Application │ │ │ ├── ApplicationInfo.swift │ │ │ └── CatFactLensRemoteApi.swift │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── iPad@1x.png │ │ │ │ ├── iPad@2x.png │ │ │ │ ├── iPadNotification@1x.png │ │ │ │ ├── iPadNotification@2x.png │ │ │ │ ├── iPadPro@2x.png │ │ │ │ ├── iPadSettings@1x-1.png │ │ │ │ ├── iPadSettings@2x.png │ │ │ │ ├── iPadSpotlight@1x.png │ │ │ │ ├── iPadSpotlight@2x.png │ │ │ │ ├── iPhone@2x.png │ │ │ │ ├── iPhone@3x.png │ │ │ │ ├── iPhoneNotification@2x.png │ │ │ │ ├── iPhoneNotification@3x.png │ │ │ │ ├── iPhoneSettings@2x.png │ │ │ │ ├── iPhoneSettings@3x.png │ │ │ │ ├── iPhoneSpotlight@2x.png │ │ │ │ └── iPhoneSpotlight@3x.png │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ │ └── LaunchScreen.storyboard │ │ ├── Info.plist │ │ ├── SCSDKCameraKitReferenceUI │ │ │ ├── Camera │ │ │ │ └── CameraController.swift │ │ │ ├── CameraButton │ │ │ │ └── CameraButton.swift │ │ │ ├── CameraUI │ │ │ │ ├── CameraView.swift │ │ │ │ └── CameraViewController.swift │ │ │ ├── Carousel │ │ │ │ └── LensPicker │ │ │ │ │ ├── LensPickerCollectionViewCell.swift │ │ │ │ │ ├── LensPickerImageLoader.swift │ │ │ │ │ ├── LensPickerItem.swift │ │ │ │ │ ├── LensPickerView.swift │ │ │ │ │ └── LensPickerViewController.swift │ │ │ ├── Helper │ │ │ │ ├── BundleHelper.swift │ │ │ │ ├── OutputSizeHelper.swift │ │ │ │ ├── UIColor+Hex.swift │ │ │ │ ├── UIFont+SCTypography.swift │ │ │ │ └── UITapGestureRecognizer+AVCaptureDevice.swift │ │ │ ├── Keyboard │ │ │ │ └── KeyboardInputAccessoryViewProvider.swift │ │ │ ├── Preview │ │ │ │ ├── ImagePreviewViewController.swift │ │ │ │ ├── PreviewViewController.swift │ │ │ │ └── VideoPreviewViewController.swift │ │ │ ├── Recorder │ │ │ │ └── Recorder.swift │ │ │ ├── Resources │ │ │ │ └── Reference.xcassets │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── ck_camera_flip.imageset │ │ │ │ │ ├── Contents.json │ │ │ │ │ └── camera-flip.svg │ │ │ │ │ ├── ck_close_circle.imageset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── close_circle@2x.png │ │ │ │ │ └── close_circle@3x.png │ │ │ │ │ ├── ck_close_x.imageset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── close_x@2x.png │ │ │ │ │ └── close_x@3x.png │ │ │ │ │ ├── ck_lens_empty.imageset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── lens_empty@2x.png │ │ │ │ │ └── lens_empty@3x.png │ │ │ │ │ ├── ck_lens_explore.imageset │ │ │ │ │ ├── Contents.json │ │ │ │ │ └── lens-explore.svg │ │ │ │ │ ├── ck_lens_placeholder.imageset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── lens_placeholder@2x.png │ │ │ │ │ └── lens_placeholder@3x.png │ │ │ │ │ ├── ck_save.imageset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── save@2x.png │ │ │ │ │ └── save@3x.png │ │ │ │ │ ├── ck_share.imageset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── share@2x.png │ │ │ │ │ └── share@3x.png │ │ │ │ │ └── ck_snap_ghost_outline.imageset │ │ │ │ │ ├── Contents.json │ │ │ │ │ └── snap-ghost-logo.svg │ │ │ ├── Snapchat │ │ │ │ └── Snapchat.swift │ │ │ ├── Support │ │ │ │ └── Testable.swift │ │ │ ├── UserData │ │ │ │ └── UserDataProvider.swift │ │ │ └── Views │ │ │ │ ├── ClearLensView.swift │ │ │ │ ├── SnapWatermarkView.swift │ │ │ │ └── TapAnimationView.swift │ │ ├── lens_icons │ │ │ └── a75243b2-55fb-4e8f-8227-2ce6ce43b169.png │ │ └── lenses │ │ │ └── 11660437246.big_mouth.lns │ └── README.md ├── CameraKitBasicSample │ ├── .gitignore │ ├── CameraKitBasicSample.xcodeproj │ │ └── project.pbxproj │ └── CameraKitBasicSample │ │ ├── AppDelegate.swift │ │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ │ ├── CameraViewController.swift │ │ ├── Documentation.docc │ │ └── Documentation.md │ │ └── Info.plist └── CameraKitSample │ ├── .gitignore │ ├── CameraKitSample.xcodeproj │ └── project.pbxproj │ ├── CameraKitSample │ ├── AppDelegate.swift │ ├── Application │ │ ├── ApplicationInfo.swift │ │ ├── CatFactLensRemoteApi.swift │ │ ├── Debug │ │ │ ├── APITokenView.swift │ │ │ ├── DebugStore.swift │ │ │ ├── DebugView.swift │ │ │ └── LensGroupIDsView.swift │ │ └── en.lproj │ │ │ └── Localizable.strings │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── iPad@1x.png │ │ │ ├── iPad@2x.png │ │ │ ├── iPadNotification@1x.png │ │ │ ├── iPadNotification@2x.png │ │ │ ├── iPadPro@2x.png │ │ │ ├── iPadSettings@1x-1.png │ │ │ ├── iPadSettings@2x.png │ │ │ ├── iPadSpotlight@1x.png │ │ │ ├── iPadSpotlight@2x.png │ │ │ ├── iPhone@2x.png │ │ │ ├── iPhone@3x.png │ │ │ ├── iPhoneNotification@2x.png │ │ │ ├── iPhoneNotification@3x.png │ │ │ ├── iPhoneSettings@2x.png │ │ │ ├── iPhoneSettings@3x.png │ │ │ ├── iPhoneSpotlight@2x.png │ │ │ └── iPhoneSpotlight@3x.png │ │ ├── Contents.json │ │ ├── DebugActive.imageset │ │ │ ├── Contents.json │ │ │ ├── DebugActive@2x.png │ │ │ └── DebugActive@3x.png │ │ └── PushToDevice.imageset │ │ │ ├── Contents.json │ │ │ ├── PushToDevice@2x.png │ │ │ └── PushToDevice@3x.png │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── CustomizedCameraViewController.swift │ ├── Info.plist │ ├── lens_icons │ │ └── a75243b2-55fb-4e8f-8227-2ce6ce43b169.png │ └── lenses │ │ └── 11660437246.big_mouth.lns │ ├── CameraKitSampleTests │ ├── ApplicationInfoTests.swift │ └── Info.plist │ └── CameraKitSampleUITests │ ├── CameraKitSampleUITests.swift │ └── Info.plist ├── Sources ├── CameraKitBaseExtension_Wrapper │ └── Dummy.swift ├── CameraKitLoginKitAuth_Wrapper │ └── Dummy.swift ├── CameraKitPushToDeviceExtension_Wrapper │ └── Dummy.swift ├── SCSDKCameraKitReferenceSwiftUI │ ├── CameraButton.swift │ ├── CameraView.swift │ ├── CameraViewState.swift │ ├── CarouselView.swift │ ├── ImagePreviewView.swift │ ├── MediaPickerView.swift │ ├── PreviewView.swift │ └── VideoPreviewView.swift └── SCSDKCameraKitReferenceUI │ ├── Camera │ └── CameraController.swift │ ├── CameraButton │ └── CameraButton.swift │ ├── CameraUI │ ├── CameraAdjustments │ │ ├── AdjustmentControlView.swift │ │ └── ControlSlider.swift │ ├── CameraControlStrip │ │ ├── CameraActionsView.swift │ │ └── CameraConfigurableActionView.swift │ ├── CameraView.swift │ ├── CameraViewController.swift │ └── Flash │ │ ├── FlashControlView.swift │ │ ├── FlashModeSelectionView.swift │ │ └── RingLight │ │ ├── RingLightColorSelectionView.swift │ │ ├── RingLightColorSelectionViewCell.swift │ │ ├── RingLightGradientView.swift │ │ └── RingLightView.swift │ ├── Carousel │ ├── CarouselCollectionViewCell.swift │ ├── CarouselCollectionViewLayout.swift │ ├── CarouselImageLoader.swift │ ├── CarouselItem.swift │ └── CarouselView.swift │ ├── Helper │ ├── BundleHelper.swift │ ├── ButtonShadowHelper.swift │ ├── ControlDismissalHintHelper.swift │ ├── ImageHighlightHelper.swift │ ├── OutputSizeHelper.swift │ ├── UIColor+Hex.swift │ ├── UIFont+SCTypography.swift │ └── UITapGestureRecognizer+AVCaptureDevice.swift │ ├── Keyboard │ └── KeyboardInputAccessoryViewProvider.swift │ ├── Localization │ └── LocalizedString.swift │ ├── MediaPicker │ ├── MediaPickerView.swift │ ├── MediaPickerViewCell.swift │ └── MediaPickerViewLoadingFooter.swift │ ├── Preview │ ├── ImagePreviewViewController.swift │ ├── PreviewViewController.swift │ └── VideoPreviewViewController.swift │ ├── Recorder │ └── Recorder.swift │ ├── Resources │ ├── Reference.xcassets │ │ ├── Contents.json │ │ ├── ck_adjustment_settings.imageset │ │ │ ├── Contents.json │ │ │ ├── ring_flash_settings@2x.png │ │ │ └── ring_flash_settings@3x.png │ │ ├── ck_camera_flip.imageset │ │ │ ├── Contents.json │ │ │ ├── Icon@2x.png │ │ │ └── Icon@3x.png │ │ ├── ck_close_circle.imageset │ │ │ ├── Contents.json │ │ │ ├── close_circle@2x.png │ │ │ └── close_circle@3x.png │ │ ├── ck_close_x.imageset │ │ │ ├── Contents.json │ │ │ ├── close_x@2x.png │ │ │ └── close_x@3x.png │ │ ├── ck_flash_off.imageset │ │ │ ├── Contents.json │ │ │ ├── flash_off@2x.png │ │ │ └── flash_off@3x.png │ │ ├── ck_flash_on.imageset │ │ │ ├── Contents.json │ │ │ ├── flash@2x.png │ │ │ └── flash@3x.png │ │ ├── ck_lens_empty.imageset │ │ │ ├── Contents.json │ │ │ ├── lens_empty@2x.png │ │ │ └── lens_empty@3x.png │ │ ├── ck_lens_placeholder.imageset │ │ │ ├── Contents.json │ │ │ ├── lens_placeholder@2x.png │ │ │ └── lens_placeholder@3x.png │ │ ├── ck_portrait.imageset │ │ │ ├── Contents.json │ │ │ ├── icon@2x.png │ │ │ └── icon@3x.png │ │ ├── ck_save.imageset │ │ │ ├── Contents.json │ │ │ ├── save@2x.png │ │ │ └── save@3x.png │ │ ├── ck_share.imageset │ │ │ ├── Contents.json │ │ │ ├── share@2x.png │ │ │ └── share@3x.png │ │ ├── ck_slider_thumb.imageset │ │ │ ├── Contents.json │ │ │ ├── Selector@2x.png │ │ │ └── Selector@3x.png │ │ ├── ck_snap_ghost.imageset │ │ │ ├── Contents.json │ │ │ ├── snap_ghost@2x.png │ │ │ └── snap_ghost@3x.png │ │ ├── ck_snap_ghost_outline.imageset │ │ │ ├── Contents.json │ │ │ └── Strokesnapghost.svg │ │ ├── ck_snapchat_app_icon.imageset │ │ │ ├── Contents.json │ │ │ ├── snapchat_app_icon@2x.png │ │ │ └── snapchat_app_icon@3x.png │ │ ├── ck_tone_mode_off.imageset │ │ │ ├── Contents.json │ │ │ ├── Tone_Mode_off@2x.png │ │ │ └── Tone_Mode_off@3x.png │ │ └── ck_tone_mode_on.imageset │ │ │ ├── Contents.json │ │ │ ├── Subtract@2x.png │ │ │ └── Subtract@3x.png │ └── Strings │ │ ├── ar.lproj │ │ └── Localizable.strings │ │ ├── bn-BD.lproj │ │ └── Localizable.strings │ │ ├── bn-IN.lproj │ │ └── Localizable.strings │ │ ├── da.lproj │ │ └── Localizable.strings │ │ ├── de.lproj │ │ └── Localizable.strings │ │ ├── el.lproj │ │ └── Localizable.strings │ │ ├── en-GB.lproj │ │ └── Localizable.strings │ │ ├── en.lproj │ │ └── Localizable.strings │ │ ├── es-AR.lproj │ │ └── Localizable.strings │ │ ├── es-ES.lproj │ │ └── Localizable.strings │ │ ├── es-MX.lproj │ │ └── Localizable.strings │ │ ├── es.lproj │ │ └── Localizable.strings │ │ ├── fi.lproj │ │ └── Localizable.strings │ │ ├── fil-PH.lproj │ │ └── Localizable.strings │ │ ├── fr.lproj │ │ └── Localizable.strings │ │ ├── gu-IN.lproj │ │ └── Localizable.strings │ │ ├── hi-IN.lproj │ │ └── Localizable.strings │ │ ├── id.lproj │ │ └── Localizable.strings │ │ ├── it.lproj │ │ └── Localizable.strings │ │ ├── ja.lproj │ │ └── Localizable.strings │ │ ├── kn-IN.lproj │ │ └── Localizable.strings │ │ ├── ko.lproj │ │ └── Localizable.strings │ │ ├── ml-IN.lproj │ │ └── Localizable.strings │ │ ├── mr-IN.lproj │ │ └── Localizable.strings │ │ ├── ms-MY.lproj │ │ └── Localizable.strings │ │ ├── nb.lproj │ │ └── Localizable.strings │ │ ├── nl.lproj │ │ └── Localizable.strings │ │ ├── pa-IN.lproj │ │ └── Localizable.strings │ │ ├── pl.lproj │ │ └── Localizable.strings │ │ ├── pt-PT.lproj │ │ └── Localizable.strings │ │ ├── pt.lproj │ │ └── Localizable.strings │ │ ├── ro.lproj │ │ └── Localizable.strings │ │ ├── ru.lproj │ │ └── Localizable.strings │ │ ├── sv.lproj │ │ └── Localizable.strings │ │ ├── ta-IN.lproj │ │ └── Localizable.strings │ │ ├── te-IN.lproj │ │ └── Localizable.strings │ │ ├── th-TH.lproj │ │ └── Localizable.strings │ │ ├── tr.lproj │ │ └── Localizable.strings │ │ ├── ur-PK.lproj │ │ └── Localizable.strings │ │ ├── vi-VN.lproj │ │ └── Localizable.strings │ │ ├── zh-Hans.lproj │ │ └── Localizable.strings │ │ └── zh-Hant.lproj │ │ └── Localizable.strings │ ├── Snapchat │ └── Snapchat.swift │ ├── Support │ └── Testable.swift │ ├── UserData │ └── UserDataProvider.swift │ └── Views │ ├── CameraBottomBar.swift │ ├── MessageNotificationView.swift │ ├── SnapAttributionView.swift │ └── TapAnimationView.swift └── VERSION /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## Obj-C/Swift specific 9 | *.hmap 10 | 11 | ## App packaging 12 | *.ipa 13 | *.dSYM.zip 14 | *.dSYM 15 | 16 | ## Playgrounds 17 | timeline.xctimeline 18 | playground.xcworkspace 19 | 20 | # Swift Package Manager 21 | # 22 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 23 | # Packages/ 24 | # Package.pins 25 | # Package.resolved 26 | # *.xcodeproj 27 | # 28 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 29 | # hence it is not needed unless you have added a package configuration file to your project 30 | # .swiftpm 31 | 32 | .build/ 33 | 34 | # CocoaPods 35 | # 36 | # We recommend against adding the Pods directory to your .gitignore. However 37 | # you should judge for yourself, the pros and cons are mentioned at: 38 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 39 | # 40 | # Pods/ 41 | # 42 | # Add this line if you want to avoid checking in source code from the Xcode workspace 43 | # *.xcworkspace 44 | 45 | # Carthage 46 | # 47 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 48 | # Carthage/Checkouts 49 | 50 | Carthage/Build/ 51 | 52 | # fastlane 53 | # 54 | # It is recommended to not store the screenshots in the git repo. 55 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 56 | # For more information about the recommended setup visit: 57 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 58 | 59 | fastlane/report.xml 60 | fastlane/Preview.html 61 | fastlane/screenshots/**/*.png 62 | fastlane/test_output -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | License for Camera Kit: 2 | 3 | © 2023 Snap Inc. All Rights Reserved. 4 | 5 | Access to or use of Camera Kit and its associated documentation, software code, and other materials (collectively, “Camera Kit”), made available by Snap Inc. and its affiliates ("Snap"), is subject to the Snap Camera Kit Terms, which you have already accepted and can be found at: 6 | 7 | https://www.snap.com/terms/snap-camera-kit 8 | 9 | If you no longer want to be a party to these terms, or if you do not agree to all of these terms, do not use or otherwise access Camera Kit and notify Snap immediately. Camera Kit may contain Snap confidential information. 10 | 11 | Separately, the sample iOS and Android apps made available here for demonstration purposes are licensed under the MIT License as reproduced below. 12 | 13 | License for sample iOS and Android apps: 14 | 15 | © 2023 Snap Inc. All Rights Reserved. 16 | 17 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 18 | 19 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Third party software that may be included in android version of Camera Kit - https://support.snapchat.com/article/licenses-android 2 | 3 | Third party software that may be included in iOS version of Camera Kit - https://support.snapchat.com/article/licenses-ios 4 | 5 | The following software may be included in iOS version of Camera Kit: PINCache, Cassette 6 | 7 | This software is subject to the following license and notice: 8 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 11 | 12 | The following software may be included in Android version of Camera Kit: Kotlin, DiskLruCache, Tape, RxJava, RxJavaExtensions, ExoPlayer 13 | 14 | This software is subject to the following license and notice: 15 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at 16 | http://www.apache.org/licenses/LICENSE-2.0 17 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.4 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "CameraKit", 7 | defaultLocalization: "en", 8 | platforms: [.iOS(.v13)], 9 | products: [ 10 | .library(name: "SCSDKCameraKit", targets: ["SCSDKCameraKit"]), 11 | .library(name: "SCSDKCameraKitBaseExtension", targets: ["SCSDKCameraKitBaseExtension_Wrapper"]), 12 | .library(name: "SCSDKCameraKitLoginKitAuth", targets: ["SCSDKCameraKitLoginKitAuth_Wrapper"]), 13 | .library(name: "SCSDKCameraKitPushToDeviceExtension", targets: ["SCSDKCameraKitPushToDeviceExtension_Wrapper"]), 14 | .library(name: "SCSDKCameraKitReferenceUI", targets: ["SCSDKCameraKitReferenceUI"]), 15 | .library(name: "SCSDKCameraKitReferenceSwiftUI", targets: ["SCSDKCameraKitReferenceSwiftUI"]), 16 | ], 17 | dependencies: [ 18 | .package(url: "https://github.com/Snapchat/snap-kit-spm", .upToNextMajor(from: "2.5.0")) 19 | ], 20 | targets: [ 21 | .binaryTarget( 22 | name: "SCSDKCameraKit", 23 | url: "https://storage.googleapis.com/snap-kit-build/scsdk/camera-kit-ios/releases-spm/1.40.0/SCSDKCameraKit.xcframework.zip", 24 | checksum: "922c9631da7bc3f4b803c62ac82b1da2094a2e47869438519c315f72d1254c69" 25 | ), 26 | 27 | .binaryTarget( 28 | name: "SCSDKCameraKitBaseExtension", 29 | url: "https://storage.googleapis.com/snap-kit-build/scsdk/camera-kit-ios/releases-spm/1.40.0/SCSDKCameraKitBaseExtension.xcframework.zip", 30 | checksum: "7eaae9a1671ee9c2445946c509afdb1e97879a24f8211f63a734b464a3b419e5" 31 | ), 32 | .target( 33 | name: "SCSDKCameraKitBaseExtension_Wrapper", 34 | dependencies: [ 35 | .target(name: "SCSDKCameraKitBaseExtension"), 36 | .target(name: "SCSDKCameraKit") 37 | ], 38 | path: "Sources/CameraKitBaseExtension_Wrapper" 39 | ), 40 | 41 | .binaryTarget( 42 | name: "SCSDKCameraKitLoginKitAuth", 43 | url: "https://storage.googleapis.com/snap-kit-build/scsdk/camera-kit-ios/releases-spm/1.40.0/SCSDKCameraKitLoginKitAuth.xcframework.zip", 44 | checksum: "36aae5f1a5fde1eb841aaf4cb52c9b936a5262e3d392f17318b7b8427b131c9a" 45 | ), 46 | .target( 47 | name: "SCSDKCameraKitLoginKitAuth_Wrapper", 48 | dependencies: [ 49 | .target(name: "SCSDKCameraKitLoginKitAuth"), 50 | .target(name: "SCSDKCameraKit"), 51 | .product(name: "SnapSDK", package: "snap-kit-spm") 52 | ], 53 | path: "Sources/CameraKitLoginKitAuth_Wrapper" 54 | ), 55 | 56 | .binaryTarget( 57 | name: "SCSDKCameraKitPushToDeviceExtension", 58 | url: "https://storage.googleapis.com/snap-kit-build/scsdk/camera-kit-ios/releases-spm/1.40.0/SCSDKCameraKitPushToDeviceExtension.xcframework.zip", 59 | checksum: "bc9b7c3273253e94577dd5890fff46697ebfcfacd96870a75112b17275c82270" 60 | ), 61 | .target( 62 | name: "SCSDKCameraKitPushToDeviceExtension_Wrapper", 63 | dependencies: [ 64 | .target(name: "SCSDKCameraKitPushToDeviceExtension"), 65 | .target(name: "SCSDKCameraKitBaseExtension_Wrapper"), 66 | ], 67 | path: "Sources/CameraKitPushToDeviceExtension_Wrapper" 68 | ), 69 | 70 | .target(name: "SCSDKCameraKitReferenceUI", dependencies: ["SCSDKCameraKit"], path: "Sources/SCSDKCameraKitReferenceUI"), 71 | .target(name: "SCSDKCameraKitReferenceSwiftUI", dependencies: ["SCSDKCameraKitReferenceUI"], path: "Sources/SCSDKCameraKitReferenceSwiftUI") 72 | ] 73 | ) 74 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | .bundle/ 52 | 53 | .gem-out/ 54 | 55 | # CocoaPods 56 | # 57 | # We recommend against adding the Pods directory to your .gitignore. However 58 | # you should judge for yourself, the pros and cons are mentioned at: 59 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 60 | # 61 | Pods/ 62 | Podfile 63 | Podfile.lock 64 | 65 | # 66 | # Add this line if you want to avoid checking in source code from the Xcode workspace 67 | *.xcworkspace 68 | 69 | # Carthage 70 | # 71 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 72 | # Carthage/Checkouts 73 | 74 | Carthage/Build/ 75 | 76 | # Accio dependency management 77 | Dependencies/ 78 | .accio/ 79 | 80 | # fastlane 81 | # 82 | # It is recommended to not store the screenshots in the git repo. 83 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 84 | # For more information about the recommended setup visit: 85 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 86 | 87 | fastlane/report.xml 88 | fastlane/Preview.html 89 | fastlane/screenshots/**/*.png 90 | fastlane/test_output 91 | 92 | # Code Injection 93 | # 94 | # After new code Injection tools there's a generated folder /iOSInjectionProject 95 | # https://github.com/johnno1962/injectionforxcode 96 | 97 | iOSInjectionProject/ 98 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKitSample 3 | 4 | import UIKit 5 | import SCSDKCameraKit 6 | import SCSDKCreativeKit 7 | 8 | @UIApplicationMain 9 | class AppDelegate: UIResponder, UIApplicationDelegate, SnapchatDelegate { 10 | 11 | private enum Constants { 12 | static let partnerGroupId = "REPLACE-THIS-WITH-YOUR-OWN-APP-SPECIFIC-VALUE" 13 | } 14 | 15 | var window: UIWindow? 16 | fileprivate var supportedOrientations: UIInterfaceOrientationMask = .portrait 17 | 18 | let snapAPI = SCSDKSnapAPI() 19 | let cameraController = SampleCameraController() 20 | 21 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 22 | window = UIWindow(frame: UIScreen.main.bounds) 23 | cameraController.groupIDs = [SCCameraKitLensRepositoryBundledGroup, Constants.partnerGroupId] 24 | window?.overrideUserInterfaceStyle = .dark 25 | 26 | cameraController.snapchatDelegate = self 27 | let cameraViewController = CameraViewController(cameraController: cameraController) 28 | cameraViewController.appOrientationDelegate = self 29 | window?.rootViewController = cameraViewController 30 | window?.makeKeyAndVisible() 31 | 32 | return true 33 | } 34 | 35 | func cameraKitViewController(_ viewController: UIViewController, openSnapchat screen: SnapchatScreen) { 36 | switch screen { 37 | case .profile, .lens(_): 38 | // not supported yet in creative kit (1.4.2), should be added in next version 39 | break 40 | case .photo(let image): 41 | let photo = SCSDKSnapPhoto(image: image) 42 | let content = SCSDKPhotoSnapContent(snapPhoto: photo) 43 | sendSnapContent(content, viewController: viewController) 44 | case .video(let url): 45 | let video = SCSDKSnapVideo(videoUrl: url) 46 | let content = SCSDKVideoSnapContent(snapVideo: video) 47 | sendSnapContent(content, viewController: viewController) 48 | } 49 | } 50 | 51 | private func sendSnapContent(_ content: SCSDKSnapContent, viewController: UIViewController) { 52 | viewController.view.isUserInteractionEnabled = false 53 | snapAPI.startSending(content) { error in 54 | DispatchQueue.main.async { 55 | viewController.view.isUserInteractionEnabled = true 56 | } 57 | if let error = error { 58 | print("Failed to send content to Snapchat with error: \(error.localizedDescription)") 59 | return 60 | } 61 | } 62 | } 63 | 64 | func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { 65 | return supportedOrientations 66 | } 67 | } 68 | 69 | // MARK: Helper Orientation Methods 70 | 71 | extension AppDelegate: AppOrientationDelegate { 72 | 73 | func lockOrientation(_ orientation: UIInterfaceOrientationMask) { 74 | supportedOrientations = orientation 75 | } 76 | 77 | func unlockOrientation() { 78 | supportedOrientations = .allButUpsideDown 79 | } 80 | 81 | } 82 | 83 | // MARK: Data Provider 84 | 85 | class SampleCameraController: CameraController { 86 | override func configureDataProvider() -> DataProviderComponent { 87 | DataProviderComponent( 88 | deviceMotion: nil, userData: UserDataProvider(), lensHint: nil, location: nil, 89 | mediaPicker: lensMediaProvider, remoteApiServiceProviders: [CatFactRemoteApiServiceProvider()]) 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Application/ApplicationInfo.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKitSample 3 | 4 | import Foundation 5 | 6 | struct ApplicationInfo { 7 | private struct Constants { 8 | static let buildKey = "CFBundleVersion" 9 | static let versionKey = "CFBundleShortVersionString" 10 | } 11 | 12 | static var build: String? { 13 | return Bundle.main.infoDictionary?[Constants.buildKey] as? String 14 | } 15 | 16 | static var version: String? { 17 | return Bundle.main.infoDictionary?[Constants.versionKey] as? String 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Application/CatFactLensRemoteApi.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKitSample 3 | 4 | import Foundation 5 | import SCSDKCameraKit 6 | 7 | // Example implementation of [LensRemoteApiService] which receives requests from lenses that use the 8 | // [Remote Service Module](https://docs.snap.com/lens-studio/references/guides/lens-features/remote-apis/remote-service-module) 9 | // feature. The remote API spec ID is provided for demo and testing purposes - 10 | // CameraKit user applications are expected to define their own specs for any remote API that they are interested to 11 | // communicate with. Please reach out to CameraKit support team at https://docs.snap.com/snap-kit/support 12 | // to find out more on how to define and use this feature. 13 | class CatFactRemoteApiServiceProvider: NSObject, LensRemoteApiServiceProvider { 14 | 15 | var supportedApiSpecIds: Set = ["03d765c5-20bd-4495-9a27-30629649cf57"] 16 | 17 | func remoteApiService(for lens: Lens) -> LensRemoteApiService { 18 | return CatFactRemoteApiService() 19 | } 20 | } 21 | 22 | class CatFactRemoteApiService: NSObject, LensRemoteApiService { 23 | 24 | private enum Constants { 25 | static let scheme = "https" 26 | static let host = "catfact.ninja" 27 | } 28 | 29 | private let urlSession: URLSession = .shared 30 | 31 | func processRequest( 32 | _ request: LensRemoteApiRequest, 33 | responseHandler: @escaping (LensRemoteApiServiceCallStatus, LensRemoteApiResponseProtocol) -> Void 34 | ) -> LensRemoteApiServiceCall { 35 | guard let url = url(request: request) else { 36 | return IgnoredRemoteApiServiceCall() 37 | } 38 | 39 | let task = urlSession.dataTask(with: url) { data, urlResponse, error in 40 | let apiResponse = LensRemoteApiResponse( 41 | request: request, 42 | status: error != nil ? .badRequest : .success, 43 | metadata: [:], 44 | body: data) 45 | 46 | responseHandler(.answered, apiResponse) 47 | } 48 | 49 | task.resume() 50 | 51 | return URLRequestRemoteApiServiceCall(task: task) 52 | } 53 | 54 | private func url(request: LensRemoteApiRequest) -> URL? { 55 | var components = URLComponents() 56 | components.host = Constants.host 57 | components.path = "/" + request.endpointId 58 | components.scheme = Constants.scheme 59 | return components.url 60 | } 61 | 62 | } 63 | 64 | class URLRequestRemoteApiServiceCall: NSObject, LensRemoteApiServiceCall { 65 | 66 | let task: URLSessionDataTask 67 | 68 | let status: LensRemoteApiServiceCallStatus = .ongoing 69 | 70 | init(task: URLSessionDataTask) { 71 | self.task = task 72 | super.init() 73 | } 74 | 75 | func cancelRequest() { 76 | task.cancel() 77 | } 78 | 79 | } 80 | 81 | class IgnoredRemoteApiServiceCall: NSObject, LensRemoteApiServiceCall { 82 | let status: LensRemoteApiServiceCallStatus = .ignored 83 | 84 | func cancelRequest() { 85 | // no-op 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "iPhoneNotification@2x.png", 5 | "idiom" : "iphone", 6 | "scale" : "2x", 7 | "size" : "20x20" 8 | }, 9 | { 10 | "filename" : "iPhoneNotification@3x.png", 11 | "idiom" : "iphone", 12 | "scale" : "3x", 13 | "size" : "20x20" 14 | }, 15 | { 16 | "filename" : "iPhoneSettings@2x.png", 17 | "idiom" : "iphone", 18 | "scale" : "2x", 19 | "size" : "29x29" 20 | }, 21 | { 22 | "filename" : "iPhoneSettings@3x.png", 23 | "idiom" : "iphone", 24 | "scale" : "3x", 25 | "size" : "29x29" 26 | }, 27 | { 28 | "filename" : "iPhoneSpotlight@2x.png", 29 | "idiom" : "iphone", 30 | "scale" : "2x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "filename" : "iPhoneSpotlight@3x.png", 35 | "idiom" : "iphone", 36 | "scale" : "3x", 37 | "size" : "40x40" 38 | }, 39 | { 40 | "filename" : "iPhone@2x.png", 41 | "idiom" : "iphone", 42 | "scale" : "2x", 43 | "size" : "60x60" 44 | }, 45 | { 46 | "filename" : "iPhone@3x.png", 47 | "idiom" : "iphone", 48 | "scale" : "3x", 49 | "size" : "60x60" 50 | }, 51 | { 52 | "filename" : "iPadNotification@1x.png", 53 | "idiom" : "ipad", 54 | "scale" : "1x", 55 | "size" : "20x20" 56 | }, 57 | { 58 | "filename" : "iPadNotification@2x.png", 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "20x20" 62 | }, 63 | { 64 | "filename" : "iPadSettings@1x-1.png", 65 | "idiom" : "ipad", 66 | "scale" : "1x", 67 | "size" : "29x29" 68 | }, 69 | { 70 | "filename" : "iPadSettings@2x.png", 71 | "idiom" : "ipad", 72 | "scale" : "2x", 73 | "size" : "29x29" 74 | }, 75 | { 76 | "filename" : "iPadSpotlight@1x.png", 77 | "idiom" : "ipad", 78 | "scale" : "1x", 79 | "size" : "40x40" 80 | }, 81 | { 82 | "filename" : "iPadSpotlight@2x.png", 83 | "idiom" : "ipad", 84 | "scale" : "2x", 85 | "size" : "40x40" 86 | }, 87 | { 88 | "filename" : "iPad@1x.png", 89 | "idiom" : "ipad", 90 | "scale" : "1x", 91 | "size" : "76x76" 92 | }, 93 | { 94 | "filename" : "iPad@2x.png", 95 | "idiom" : "ipad", 96 | "scale" : "2x", 97 | "size" : "76x76" 98 | }, 99 | { 100 | "filename" : "iPadPro@2x.png", 101 | "idiom" : "ipad", 102 | "scale" : "2x", 103 | "size" : "83.5x83.5" 104 | }, 105 | { 106 | "idiom" : "ios-marketing", 107 | "scale" : "1x", 108 | "size" : "1024x1024" 109 | } 110 | ], 111 | "info" : { 112 | "author" : "xcode", 113 | "version" : 1 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPad@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPad@1x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPad@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPad@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPadNotification@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPadNotification@1x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPadNotification@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPadNotification@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPadPro@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPadPro@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPadSettings@1x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPadSettings@1x-1.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPadSettings@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPadSettings@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPadSpotlight@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPadSpotlight@1x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPadSpotlight@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPadSpotlight@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPhone@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPhone@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPhone@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPhone@3x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPhoneNotification@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPhoneNotification@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPhoneNotification@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPhoneNotification@3x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPhoneSettings@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPhoneSettings@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPhoneSettings@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPhoneSettings@3x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPhoneSpotlight@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPhoneSpotlight@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPhoneSpotlight@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/AppIcon.appiconset/iPhoneSpotlight@3x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleURLTypes 20 | 21 | 22 | CFBundleURLSchemes 23 | 24 | camerakitsandbox 25 | 26 | 27 | 28 | CFBundleVersion 29 | $(CURRENT_PROJECT_VERSION) 30 | LSApplicationCategoryType 31 | 32 | LSApplicationQueriesSchemes 33 | 34 | snapchat 35 | 36 | LSRequiresIPhoneOS 37 | 38 | NSCameraUsageDescription 39 | CameraKit Sample app uses the camera to show lenses 40 | NSLocationWhenInUseUsageDescription 41 | CameraKit Sample uses your location for location-aware lenses. 42 | NSMicrophoneUsageDescription 43 | CameraKit Sample app uses the microphone to process and record audio 44 | NSPhotoLibraryAddUsageDescription 45 | CameraKit Sample uses photo library to save captured photos and recorded videos 46 | NSPhotoLibraryUsageDescription 47 | CameraKit Sample uses photo library to save captured photos and recorded videos 48 | SCCameraKitAPIToken 49 | REPLACE-THIS-WITH-YOUR-OWN-APP-SPECIFIC-VALUE 50 | SCSDKClientId 51 | REPLACE-THIS-WITH-YOUR-OWN-APP-SPECIFIC-VALUE 52 | UILaunchStoryboardName 53 | LaunchScreen 54 | UIRequiredDeviceCapabilities 55 | 56 | armv7 57 | 58 | UISupportedInterfaceOrientations 59 | 60 | UIInterfaceOrientationPortrait 61 | UIInterfaceOrientationLandscapeLeft 62 | UIInterfaceOrientationLandscapeRight 63 | 64 | UISupportedInterfaceOrientations~ipad 65 | 66 | UIInterfaceOrientationPortrait 67 | UIInterfaceOrientationPortraitUpsideDown 68 | UIInterfaceOrientationLandscapeLeft 69 | UIInterfaceOrientationLandscapeRight 70 | 71 | UIViewControllerBasedStatusBarAppearance 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Carousel/LensPicker/LensPickerImageLoader.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKitSandbox 3 | 4 | import UIKit 5 | 6 | /// Protocol used to load an image from url 7 | public protocol LensPickerImageLoader { 8 | 9 | /// Load image from url 10 | /// - Parameters: 11 | /// - url: image url 12 | /// - completion: callback with image on success or error on failure 13 | func loadImage(url: URL, completion: ((_ image: UIImage?, _ error: Error?) -> Void)?) 14 | } 15 | 16 | /// Default image loader class which uses a URLSession to load images 17 | public class DefaultLensPickerImageLoader: LensPickerImageLoader { 18 | 19 | public let urlSession: URLSession 20 | fileprivate var tasks: [URL: URLSessionDataTask] = [:] 21 | fileprivate let taskQueue = DispatchQueue(label: "com.snap.camerakit.referenceui.imageloader") 22 | 23 | public init(urlSession: URLSession = .shared) { 24 | self.urlSession = urlSession 25 | } 26 | 27 | /// Load image from url (callback queue will be on main) 28 | /// - Parameters: 29 | /// - url: image url 30 | /// - completion: callback with image on success or error on failure 31 | public func loadImage(url: URL, completion: ((UIImage?, Error?) -> Void)?) { 32 | loadImage(url: url, queue: .main, completion: completion) 33 | } 34 | 35 | /// Load image from url 36 | /// - Parameters: 37 | /// - url: image url 38 | /// - queue: queue to call completion on 39 | /// - completion: callback with image on success or error on failure 40 | public func loadImage(url: URL, queue: DispatchQueue, completion: ((UIImage?, Error?) -> Void)?) { 41 | let task = urlSession.dataTask(with: url) { [weak self] (data, _, error) in 42 | self?.removeTask(url: url) 43 | guard let data = data, 44 | let image = UIImage(data: data) 45 | else { 46 | queue.async { 47 | completion?(nil, error) 48 | } 49 | return 50 | } 51 | queue.async { 52 | completion?(image, nil) 53 | } 54 | } 55 | 56 | addTask(task, for: url) 57 | task.resume() 58 | } 59 | 60 | public func cancelImageLoad(from url: URL) { 61 | taskQueue.async { 62 | self.tasks[url]?.cancel() 63 | self.tasks[url] = nil 64 | } 65 | } 66 | 67 | fileprivate func addTask(_ task: URLSessionDataTask, for url: URL) { 68 | taskQueue.async { 69 | self.tasks[url] = task 70 | } 71 | } 72 | 73 | fileprivate func removeTask(url: URL) { 74 | taskQueue.async { 75 | self.tasks[url] = nil 76 | } 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Carousel/LensPicker/LensPickerItem.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import UIKit 5 | 6 | /// This is the lens picker item view model which represents a specific lens icon 7 | public class LensPickerItem: Identifiable, Equatable { 8 | 9 | /// id for lens picker item 10 | public let id: String 11 | 12 | /// lens id 13 | public let lensId: String 14 | 15 | /// lens name 16 | public let lensName: String? 17 | 18 | /// group id lens belongs to 19 | public let groupId: String 20 | 21 | /// image url for lens icon 22 | public let imageUrl: URL? 23 | 24 | /// downloaded image for lens icon 25 | public var image: UIImage? 26 | 27 | /// Designated init for a lens picker item 28 | /// - Parameters: 29 | /// - lensId: lens id 30 | /// - groupId: group id that lens belongs to 31 | /// - imageUrl: optional image url of lens icon 32 | /// - image: optional loaded UIImage of icon 33 | public init(lensId: String, lensName: String?, groupId: String, imageUrl: URL? = nil, image: UIImage? = nil) { 34 | self.id = lensId + groupId 35 | self.lensId = lensId 36 | self.lensName = lensName 37 | self.groupId = groupId 38 | self.imageUrl = imageUrl 39 | self.image = image 40 | } 41 | 42 | static public func == (lhs: LensPickerItem, rhs: LensPickerItem) -> Bool { 43 | lhs.id == rhs.id 44 | } 45 | 46 | } 47 | 48 | /// Concrete class for an empty item (clear camera button) 49 | public class EmptyItem: LensPickerItem { 50 | public init() { 51 | super.init( 52 | lensId: "empty", 53 | lensName: "empty", 54 | groupId: "empty", 55 | imageUrl: nil, 56 | image: UIImage(named: "ck_lens_empty", in: BundleHelper.resourcesBundle, compatibleWith: nil)) 57 | } 58 | } 59 | 60 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Carousel/LensPicker/LensPickerViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import UIKit 5 | 6 | protocol LensPickerViewControllerDelegate: AnyObject { 7 | func didPresentLensPickerViewController() 8 | func didDismissLensPickerViewController() 9 | } 10 | 11 | /// This is the lens picker view that appears as a bottom sheet. 12 | public class LensPickerViewController: UIViewController { 13 | 14 | /// The backing view. 15 | public var lensPickerView: LensPickerView 16 | 17 | weak var delegate: LensPickerViewControllerDelegate? 18 | 19 | init(lensPickerView: LensPickerView) { 20 | self.lensPickerView = lensPickerView 21 | super.init(nibName: nil, bundle: nil) 22 | } 23 | 24 | required init?(coder: NSCoder) { 25 | fatalError("init(coder:) has not been implemented") 26 | } 27 | 28 | override open func viewDidLoad() { 29 | super.viewDidLoad() 30 | 31 | view = lensPickerView 32 | view.backgroundColor = UIColor(hex: 0x1E1E1E, alpha: 1.0) 33 | } 34 | 35 | override open func viewDidAppear(_ animated: Bool) { 36 | super.viewDidAppear(animated) 37 | } 38 | 39 | override open func viewWillAppear(_ animated: Bool) { 40 | super.viewWillAppear(animated) 41 | self.navigationController?.setNavigationBarHidden(true, animated: true) 42 | lensPickerView.reloadData() 43 | self.delegate?.didPresentLensPickerViewController() 44 | } 45 | 46 | override open func viewWillDisappear(_ animated: Bool) { 47 | self.delegate?.didDismissLensPickerViewController() 48 | lensPickerView.reloadData() 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Helper/BundleHelper.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKitSandbox 3 | 4 | import Foundation 5 | 6 | /// Internal helper to deal with resources bundle 7 | public class BundleHelper { 8 | private enum Constants { 9 | static let bundleName = "CameraKitReferenceUI" 10 | static let bundleExtension = "bundle" 11 | } 12 | 13 | /// Internal helper computed property to get correct resources bundle 14 | /// (ie. if pods, look for bundle inside main bundle) 15 | public class var resourcesBundle: Bundle { 16 | #if SWIFT_PACKAGE 17 | return .module 18 | #else 19 | let bundle = Bundle(for: self) 20 | 21 | guard 22 | let resourcesUrl = bundle.url( 23 | forResource: Constants.bundleName, withExtension: Constants.bundleExtension), 24 | let resourcesBundle = Bundle(url: resourcesUrl) 25 | else { 26 | return bundle 27 | } 28 | 29 | return resourcesBundle 30 | #endif 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Helper/OutputSizeHelper.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // SCSDKCameraKitReferenceUI 3 | 4 | import AVFoundation 5 | import Foundation 6 | 7 | /// Provides helper functions to determine output sizes given input sizes and other constraints (aspect ratio, orientation, etc.) 8 | enum OutputSizeHelper { 9 | 10 | /// Returns the size normalized to a new aspect ratio and orientation. 11 | /// For example, given an input size of 1080x1920 and aspect ratio of 0.462 and portrait orientation, 12 | /// this will return a new size of 887x1920. 13 | /// - Parameters: 14 | /// - size: The original input size to normalize. 15 | /// - aspectRatio: The aspect ratio to normalize the output size to. 16 | /// - orientation: The orientation of the input size (defaults to portrait). 17 | /// - Returns: The new size normalized to the aspect ratio. 18 | static func normalizedSize( 19 | for size: CGSize, aspectRatio: CGFloat, orientation: AVCaptureVideoOrientation = .portrait 20 | ) -> CGSize { 21 | var height = orientation == .portrait ? size.height : size.width 22 | var width = orientation == .portrait ? size.width : size.height 23 | 24 | if orientation == .landscapeLeft || orientation == .landscapeRight { 25 | if height > width * aspectRatio { 26 | height = width * aspectRatio 27 | } else { 28 | width = height / aspectRatio 29 | } 30 | } else { 31 | if width > height * aspectRatio { 32 | width = height * aspectRatio 33 | } else { 34 | height = width / aspectRatio 35 | } 36 | } 37 | 38 | return CGSize(width: width, height: height) 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Helper/UIColor+Hex.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKitSandbox 3 | 4 | import UIKit 5 | 6 | extension UIColor { 7 | public convenience init(hex: UInt, alpha: CGFloat = 1.0) { 8 | self.init( 9 | red: ((CGFloat)((hex & 0xFF0000) >> 16)) / 255.0, 10 | green: ((CGFloat)((hex & 0x00FF00) >> 8)) / 255.0, 11 | blue: ((CGFloat)((hex & 0x0000FF) >> 0)) / 255.0, 12 | alpha: alpha) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Helper/UIFont+SCTypography.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // SCSDKCameraKitReferenceUI 3 | 4 | import UIKit 5 | 6 | /// Provides access to Snapchat typography in all supported weights. 7 | public extension UIFont { 8 | 9 | static func sc_ultraLightFont(size: CGFloat) -> UIFont? { 10 | UIFont(name: "AvenirNext-UltraLight", size: size) 11 | } 12 | 13 | static func sc_regularFont(size: CGFloat) -> UIFont? { 14 | UIFont(name: "AvenirNext-Regular", size: size) 15 | } 16 | 17 | static func sc_mediumFont(size: CGFloat) -> UIFont? { 18 | UIFont(name: "AvenirNext-Medium", size: size) 19 | } 20 | 21 | static func sc_demiBoldFont(size: CGFloat) -> UIFont? { 22 | UIFont(name: "AvenirNext-DemiBold", size: size) 23 | } 24 | 25 | static func sc_boldFont(size: CGFloat) -> UIFont? { 26 | UIFont(name: "AvenirNext-Bold", size: size) 27 | } 28 | 29 | static func sc_heavyFont(size: CGFloat) -> UIFont? { 30 | UIFont(name: "AvenirNext-Heavy", size: size) 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Helper/UITapGestureRecognizer+AVCaptureDevice.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // SCSDKCameraKitReferenceUI 3 | 4 | import Foundation 5 | import UIKit 6 | 7 | extension UITapGestureRecognizer { 8 | /// Converts a point in a view to the coordinate system used by AVCaptureDevice 9 | /// AVCaptureDevice uses a coordinate system where (0, 0) is the top left and (1.0, 1.0) is the bottom right if the device 10 | /// is in landscape orientation with the home button on the right 11 | var captureDevicePoint: CGPoint? { 12 | guard let view = view else { return nil } 13 | 14 | var interfaceOrientation = UIApplication.shared.statusBarOrientation 15 | if #available(iOS 13, *), 16 | let sceneOrientation = UIApplication.shared.windows.first?.windowScene?.interfaceOrientation 17 | { 18 | interfaceOrientation = sceneOrientation 19 | } 20 | 21 | let tapPoint = location(in: view) 22 | 23 | switch interfaceOrientation { 24 | case .portrait: 25 | return CGPoint( 26 | x: tapPoint.y / view.bounds.size.height, 27 | y: 1.0 - (tapPoint.x / view.bounds.size.width) 28 | ) 29 | case .portraitUpsideDown: 30 | return CGPoint( 31 | x: 1.0 - (tapPoint.y / view.bounds.size.height), 32 | y: tapPoint.x / view.bounds.size.width 33 | ) 34 | case .landscapeRight: 35 | return CGPoint( 36 | x: tapPoint.x / view.bounds.size.width, 37 | y: tapPoint.y / view.bounds.size.height 38 | ) 39 | case .landscapeLeft: 40 | return CGPoint( 41 | x: 1.0 - (tapPoint.x / view.bounds.size.width), 42 | y: 1.0 - (tapPoint.y / view.bounds.size.height) 43 | ) 44 | default: return nil 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Preview/ImagePreviewViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKitSandbox 3 | 4 | import Photos 5 | import UIKit 6 | 7 | /// Preview view controller for showing captured photos and images 8 | public class ImagePreviewViewController: PreviewViewController { 9 | 10 | // MARK: Properties 11 | 12 | /// UIImage to display 13 | public let image: UIImage 14 | 15 | fileprivate lazy var imageView: UIImageView = { 16 | let view = UIImageView(image: image) 17 | view.accessibilityIdentifier = PreviewElements.imageView.id 18 | view.contentMode = .scaleAspectFill 19 | view.translatesAutoresizingMaskIntoConstraints = false 20 | 21 | return view 22 | }() 23 | 24 | // MARK: Init 25 | 26 | /// Designated init to pass in required deps 27 | /// - Parameter image: UIImage to display 28 | public init(image: UIImage) { 29 | self.image = image 30 | super.init(nibName: nil, bundle: nil) 31 | } 32 | 33 | required init?(coder: NSCoder) { 34 | fatalError("init(coder:) has not been implemented") 35 | } 36 | 37 | public override func viewDidLoad() { 38 | super.viewDidLoad() 39 | setup() 40 | } 41 | 42 | // MARK: Setup 43 | 44 | private func setup() { 45 | view.insertSubview(imageView, at: 0) 46 | NSLayoutConstraint.activate([ 47 | imageView.topAnchor.constraint(equalTo: view.topAnchor), 48 | imageView.leadingAnchor.constraint(equalTo: view.leadingAnchor), 49 | imageView.trailingAnchor.constraint(equalTo: view.trailingAnchor), 50 | imageView.bottomAnchor.constraint(equalTo: view.bottomAnchor), 51 | ]) 52 | } 53 | 54 | // MARK: Action Overrides 55 | 56 | override func sharePreview() { 57 | let viewController = UIActivityViewController(activityItems: [image], applicationActivities: nil) 58 | present(viewController, animated: true, completion: nil) 59 | } 60 | 61 | override func savePreview() { 62 | PHPhotoLibrary.shared().performChanges({ 63 | PHAssetChangeRequest.creationRequestForAsset(from: self.image) 64 | }) { (saved, error) in 65 | var title: String 66 | var message: String 67 | if saved { 68 | title = "Save Success" 69 | message = "Successfully saved photo to library" 70 | } else { 71 | title = "Save Failure" 72 | message = "Failed to save photo to library" 73 | print("failed to save video with error: \(error?.localizedDescription ?? "no error")") 74 | } 75 | 76 | DispatchQueue.main.async { 77 | let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert) 78 | let action = UIAlertAction(title: "OK", style: .default, handler: nil) 79 | alertController.addAction(action) 80 | self.present(alertController, animated: true, completion: nil) 81 | } 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_camera_flip.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "camera-flip.svg", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_camera_flip.imageset/camera-flip.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_circle.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "filename": "close_circle@2x.png", 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "filename": "close_circle@3x.png", 14 | "idiom": "universal", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "author": "xcode", 20 | "version": 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_circle.imageset/close_circle@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_circle.imageset/close_circle@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_circle.imageset/close_circle@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_circle.imageset/close_circle@3x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_x.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "idiom": "universal", 9 | "filename": "close_x@2x.png", 10 | "scale": "2x" 11 | }, 12 | { 13 | "idiom": "universal", 14 | "filename": "close_x@3x.png", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "version": 1, 20 | "author": "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_x.imageset/close_x@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_x.imageset/close_x@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_x.imageset/close_x@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_x.imageset/close_x@3x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_empty.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "idiom": "universal", 9 | "filename": "lens_empty@2x.png", 10 | "scale": "2x" 11 | }, 12 | { 13 | "idiom": "universal", 14 | "filename": "lens_empty@3x.png", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "version": 1, 20 | "author": "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_empty.imageset/lens_empty@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_empty.imageset/lens_empty@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_empty.imageset/lens_empty@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_empty.imageset/lens_empty@3x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_explore.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "lens-explore.svg", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_explore.imageset/lens-explore.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_placeholder.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "idiom": "universal", 9 | "filename": "lens_placeholder@2x.png", 10 | "scale": "2x" 11 | }, 12 | { 13 | "idiom": "universal", 14 | "filename": "lens_placeholder@3x.png", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "version": 1, 20 | "author": "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_placeholder.imageset/lens_placeholder@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_placeholder.imageset/lens_placeholder@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_placeholder.imageset/lens_placeholder@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_placeholder.imageset/lens_placeholder@3x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_save.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "idiom": "universal", 9 | "filename": "save@2x.png", 10 | "scale": "2x" 11 | }, 12 | { 13 | "idiom": "universal", 14 | "filename": "save@3x.png", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "version": 1, 20 | "author": "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_save.imageset/save@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_save.imageset/save@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_save.imageset/save@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_save.imageset/save@3x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_share.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "filename": "share@2x.png", 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "filename": "share@3x.png", 14 | "idiom": "universal", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "author": "xcode", 20 | "version": 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_share.imageset/share@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_share.imageset/share@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_share.imageset/share@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_share.imageset/share@3x.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_snap_ghost_outline.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "snap-ghost-logo.svg", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Snapchat/Snapchat.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKitSandbox 3 | 4 | import SCSDKCameraKit 5 | import UIKit 6 | 7 | /// Describes the Snapchat screen to open to 8 | public enum SnapchatScreen { 9 | case profile 10 | case lens(Lens) 11 | case photo(UIImage) 12 | case video(URL) 13 | } 14 | 15 | /// CameraKit view controllers will notify this delegate when it needs to open, send info, or interact with Snapchat 16 | public protocol SnapchatDelegate: AnyObject { 17 | 18 | /// CameraKit view controller requests opening Snapchat with specific info 19 | /// - Parameters: 20 | /// - viewController: CameraKit view controller instance 21 | /// - screen: Snapchat screen to open to 22 | func cameraKitViewController(_ viewController: UIViewController, openSnapchat screen: SnapchatScreen) 23 | } 24 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Support/Testable.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import Foundation 5 | 6 | /// Describes an element that can be UI tested 7 | public protocol TestableElement { 8 | 9 | /// identifier for the testable element 10 | var id: String { get } 11 | } 12 | 13 | public extension TestableElement where Self: RawRepresentable { 14 | var id: String { 15 | return "\(String(describing: type(of: self)))_\(rawValue)" 16 | } 17 | } 18 | 19 | // MARK: Camera Clear Lens 20 | 21 | /// ClearLens view testable elements 22 | public enum ClearLensElements: String, TestableElement { 23 | case closeButton 24 | } 25 | 26 | // MARK: Camera View 27 | 28 | /// CameraViewController testable elements 29 | public enum CameraElements: String, TestableElement { 30 | case lensLabel 31 | case flipCameraButton 32 | case photoLibraryButton 33 | case cameraButton 34 | case lensPickerButton 35 | } 36 | 37 | public extension CameraElements { 38 | 39 | enum CameraFlip { 40 | static public let front = "front" 41 | static public let back = "back" 42 | } 43 | 44 | } 45 | 46 | // MARK: Lens Picker 47 | 48 | /// LensPickerView testable elements 49 | public enum LensPickerElements: String, TestableElement { 50 | case collectionView 51 | case lensCell 52 | } 53 | 54 | // MARK: Preview 55 | 56 | /// PreviewViewController testable elements 57 | public enum PreviewElements: String, TestableElement { 58 | case closeButton, shareButton, imageView, playerControllerView 59 | } 60 | 61 | // MARK: Other Elements 62 | 63 | /// Other misc testable elements 64 | public enum OtherElements: String, TestableElement { 65 | case tapToFocusView 66 | } 67 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/UserData/UserDataProvider.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKitSandbox 3 | 4 | import Foundation 5 | import SCSDKCameraKit 6 | 7 | /// Default user data provider to show how to provide user data to CameraKit 8 | public class UserDataProvider: NSObject, SCSDKCameraKit.UserDataProvider { 9 | 10 | /// Delegate for CameraKit to receive updates on user data 11 | public weak var delegate: UserDataProviderDelegate? 12 | 13 | /// Mocked user data 14 | public lazy var userData: UserData? = UserData( 15 | displayName: "Jane Doe", birthDate: formatter.date(from: "1974-05-05")) 16 | 17 | /// Date formatter to formate birth date for user data 18 | private let formatter: DateFormatter = { 19 | let formatter = DateFormatter() 20 | formatter.dateFormat = "yyyy-MM-dd" 21 | return formatter 22 | }() 23 | } 24 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Views/ClearLensView.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKitSandbox 3 | 4 | import UIKit 5 | 6 | /// Current lens information bar as well as close button to clear current lens 7 | public class ClearLensView: UIView { 8 | private enum Constants { 9 | static let closeCircle = "ck_close_circle" 10 | } 11 | 12 | /// Close button to clear current lens 13 | public let closeButton: UIButton = { 14 | let button = UIButton() 15 | button.accessibilityIdentifier = ClearLensElements.closeButton.id 16 | button.setImage( 17 | UIImage(named: Constants.closeCircle, in: BundleHelper.resourcesBundle, compatibleWith: nil), for: .normal) 18 | button.translatesAutoresizingMaskIntoConstraints = false 19 | 20 | return button 21 | }() 22 | 23 | /// Current lens name 24 | public let lensLabel: UILabel = { 25 | let label = UILabel() 26 | label.translatesAutoresizingMaskIntoConstraints = false 27 | label.textColor = .white 28 | label.font = UIFont.sc_demiBoldFont(size: 14) 29 | label.textAlignment = .center 30 | 31 | return label 32 | }() 33 | 34 | /// Lens Icon 35 | public let imageView: UIImageView = { 36 | let view = UIImageView() 37 | view.translatesAutoresizingMaskIntoConstraints = false 38 | 39 | return view 40 | }() 41 | 42 | init() { 43 | super.init(frame: .zero) 44 | commonInit() 45 | } 46 | 47 | override init(frame: CGRect) { 48 | super.init(frame: frame) 49 | commonInit() 50 | } 51 | 52 | required init?(coder: NSCoder) { 53 | super.init(coder: coder) 54 | commonInit() 55 | } 56 | 57 | private func commonInit() { 58 | layer.cornerRadius = 12 59 | addSubview(lensLabel) 60 | addSubview(closeButton) 61 | addSubview(imageView) 62 | 63 | setupConstraints() 64 | } 65 | 66 | private func setupConstraints() { 67 | NSLayoutConstraint.activate([ 68 | imageView.centerYAnchor.constraint(equalTo: centerYAnchor), 69 | imageView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 8), 70 | imageView.widthAnchor.constraint(equalToConstant: 24), 71 | imageView.heightAnchor.constraint(equalToConstant: 24), 72 | 73 | lensLabel.centerYAnchor.constraint(equalTo: centerYAnchor), 74 | lensLabel.leadingAnchor.constraint(equalTo: imageView.trailingAnchor, constant: 8), 75 | 76 | closeButton.centerYAnchor.constraint(equalTo: centerYAnchor), 77 | closeButton.leadingAnchor.constraint(equalTo: lensLabel.trailingAnchor, constant: 8), 78 | closeButton.widthAnchor.constraint(equalToConstant: 24), 79 | closeButton.heightAnchor.constraint(equalToConstant: 24), 80 | 81 | trailingAnchor.constraint(equalTo: closeButton.trailingAnchor, constant: 8), 82 | ]) 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/SCSDKCameraKitReferenceUI/Views/SnapWatermarkView.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import UIKit 5 | 6 | /// Bottom bar on Camera that contains Snap ghost button for actions 7 | /// as well as close button to clear current lens 8 | public class SnapWatermarkView: UIView { 9 | private enum Constants { 10 | static let poweredBy = "Powered by" 11 | static let snapGhostOutline = "ck_snap_ghost_outline" 12 | } 13 | 14 | public let poweredByLabel: UILabel = { 15 | let label = UILabel() 16 | label.translatesAutoresizingMaskIntoConstraints = false 17 | label.textColor = .white 18 | label.font = UIFont.sc_regularFont(size: 18) 19 | label.textAlignment = .center 20 | label.text = Constants.poweredBy 21 | label.sizeToFit() 22 | 23 | return label 24 | }() 25 | 26 | public let snapIconImage: UIImageView = { 27 | let imageView = UIImageView() 28 | imageView.image = UIImage(named: Constants.snapGhostOutline, in: BundleHelper.resourcesBundle, compatibleWith: nil) 29 | imageView.translatesAutoresizingMaskIntoConstraints = false 30 | 31 | return imageView 32 | }() 33 | 34 | init() { 35 | super.init(frame: .zero) 36 | commonInit() 37 | } 38 | 39 | override init(frame: CGRect) { 40 | super.init(frame: frame) 41 | commonInit() 42 | } 43 | 44 | required init?(coder: NSCoder) { 45 | super.init(coder: coder) 46 | commonInit() 47 | } 48 | 49 | private func commonInit() { 50 | addSubview(poweredByLabel) 51 | addSubview(snapIconImage) 52 | 53 | setupConstraints() 54 | } 55 | 56 | private func setupConstraints() { 57 | NSLayoutConstraint.activate([ 58 | widthAnchor.constraint(equalToConstant: 124), 59 | 60 | poweredByLabel.leadingAnchor.constraint(equalTo: leadingAnchor), 61 | poweredByLabel.centerYAnchor.constraint(equalTo: centerYAnchor), 62 | 63 | snapIconImage.leadingAnchor.constraint(equalTo: poweredByLabel.trailingAnchor, constant: 4), 64 | snapIconImage.centerYAnchor.constraint(equalTo: centerYAnchor), 65 | ]) 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/lens_icons/a75243b2-55fb-4e8f-8227-2ce6ce43b169.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/lens_icons/a75243b2-55fb-4e8f-8227-2ce6ce43b169.png -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/lenses/11660437246.big_mouth.lns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitAlternateCarouselSample/CameraKitAlternateCarouselSample/lenses/11660437246.big_mouth.lns -------------------------------------------------------------------------------- /Samples/CameraKitAlternateCarouselSample/README.md: -------------------------------------------------------------------------------- 1 | # Camera Kit Alternate Lenses Carousel Sample App 2 | 3 | This sample app shows how to create an alternate carousel to select lenses and display a camera view with lenses applied using Camera Kit. 4 | 5 | ## Interaction examples 6 | 7 | 1) Alternate carousel opening and closing: 8 | 9 | ![sample_alternate_carousel_open_and_close](https://github.com/user-attachments/assets/c5846bc4-e668-4275-8d51-d81b27085566) 10 | 11 | 2) Clearing applied lenses: 12 | 13 | ![sample_alternate_carousel_clear_lens](https://github.com/user-attachments/assets/ec23d168-e218-499e-91c1-1b5436828287) 14 | 15 | -------------------------------------------------------------------------------- /Samples/CameraKitBasicSample/.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | .bundle/ 52 | 53 | .gem-out/ 54 | 55 | # CocoaPods 56 | # 57 | # We recommend against adding the Pods directory to your .gitignore. However 58 | # you should judge for yourself, the pros and cons are mentioned at: 59 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 60 | # 61 | Pods/ 62 | Podfile 63 | Podfile.lock 64 | 65 | # 66 | # Add this line if you want to avoid checking in source code from the Xcode workspace 67 | *.xcworkspace 68 | 69 | # Carthage 70 | # 71 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 72 | # Carthage/Checkouts 73 | 74 | Carthage/Build/ 75 | 76 | # Accio dependency management 77 | Dependencies/ 78 | .accio/ 79 | 80 | # fastlane 81 | # 82 | # It is recommended to not store the screenshots in the git repo. 83 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 84 | # For more information about the recommended setup visit: 85 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 86 | 87 | fastlane/report.xml 88 | fastlane/Preview.html 89 | fastlane/screenshots/**/*.png 90 | fastlane/test_output 91 | 92 | # Code Injection 93 | # 94 | # After new code Injection tools there's a generated folder /iOSInjectionProject 95 | # https://github.com/johnno1962/injectionforxcode 96 | 97 | iOSInjectionProject/ 98 | -------------------------------------------------------------------------------- /Samples/CameraKitBasicSample/CameraKitBasicSample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import SCSDKCameraKit 3 | 4 | @main 5 | class AppDelegate: UIResponder, UIApplicationDelegate { 6 | var window: UIWindow? 7 | 8 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 9 | window = UIWindow(frame: UIScreen.main.bounds) 10 | let viewController = CameraViewController() 11 | window?.rootViewController = viewController 12 | window?.makeKeyAndVisible() 13 | return true 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Samples/CameraKitBasicSample/CameraKitBasicSample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Samples/CameraKitBasicSample/CameraKitBasicSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSCameraUsageDescription 6 | CameraKit Basic Sample app uses the camera to apply Lenses 7 | NSMicrophoneUsageDescription 8 | CameraKit Basic Sample app uses microphone for post capture 9 | 10 | 11 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | .bundle/ 52 | 53 | .gem-out/ 54 | 55 | # CocoaPods 56 | # 57 | # We recommend against adding the Pods directory to your .gitignore. However 58 | # you should judge for yourself, the pros and cons are mentioned at: 59 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 60 | # 61 | Pods/ 62 | Podfile 63 | Podfile.lock 64 | 65 | # 66 | # Add this line if you want to avoid checking in source code from the Xcode workspace 67 | *.xcworkspace 68 | 69 | # Carthage 70 | # 71 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 72 | # Carthage/Checkouts 73 | 74 | Carthage/Build/ 75 | 76 | # Accio dependency management 77 | Dependencies/ 78 | .accio/ 79 | 80 | # fastlane 81 | # 82 | # It is recommended to not store the screenshots in the git repo. 83 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 84 | # For more information about the recommended setup visit: 85 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 86 | 87 | fastlane/report.xml 88 | fastlane/Preview.html 89 | fastlane/screenshots/**/*.png 90 | fastlane/test_output 91 | 92 | # Code Injection 93 | # 94 | # After new code Injection tools there's a generated folder /iOSInjectionProject 95 | # https://github.com/johnno1962/injectionforxcode 96 | 97 | iOSInjectionProject/ 98 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Application/ApplicationInfo.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKitSample 3 | 4 | import Foundation 5 | 6 | struct ApplicationInfo { 7 | private struct Constants { 8 | static let buildKey = "CFBundleVersion" 9 | static let versionKey = "CFBundleShortVersionString" 10 | static let apiToken = "SCCameraKitAPIToken" 11 | } 12 | 13 | static var build: String? { 14 | return Bundle.main.infoDictionary?[Constants.buildKey] as? String 15 | } 16 | 17 | static var version: String? { 18 | return Bundle.main.infoDictionary?[Constants.versionKey] as? String 19 | } 20 | 21 | static var apiToken: String? { 22 | return Bundle.main.infoDictionary?[Constants.apiToken] as? String 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Application/CatFactLensRemoteApi.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKitSample 3 | 4 | import Foundation 5 | import SCSDKCameraKit 6 | 7 | // Example implementation of [LensRemoteApiService] which receives requests from lenses that use the 8 | // [Remote Service Module](https://docs.snap.com/lens-studio/references/guides/lens-features/remote-apis/remote-service-module) 9 | // feature. The remote API spec ID is provided for demo and testing purposes - 10 | // CameraKit user applications are expected to define their own specs for any remote API that they are interested to 11 | // communicate with. Please reach out to CameraKit support team at https://docs.snap.com/snap-kit/support 12 | // to find out more on how to define and use this feature. 13 | class CatFactRemoteApiServiceProvider: NSObject, LensRemoteApiServiceProvider { 14 | 15 | var supportedApiSpecIds: Set = ["03d765c5-20bd-4495-9a27-30629649cf57"] 16 | 17 | func remoteApiService(for lens: Lens) -> LensRemoteApiService { 18 | return CatFactRemoteApiService() 19 | } 20 | } 21 | 22 | class CatFactRemoteApiService: NSObject, LensRemoteApiService { 23 | 24 | private enum Constants { 25 | static let scheme = "https" 26 | static let host = "catfact.ninja" 27 | } 28 | 29 | private let urlSession: URLSession = .shared 30 | 31 | func processRequest( 32 | _ request: LensRemoteApiRequest, 33 | responseHandler: @escaping (LensRemoteApiServiceCallStatus, LensRemoteApiResponseProtocol) -> Void 34 | ) -> LensRemoteApiServiceCall { 35 | guard let url = url(request: request) else { 36 | return IgnoredRemoteApiServiceCall() 37 | } 38 | 39 | let task = urlSession.dataTask(with: url) { data, urlResponse, error in 40 | let apiResponse = LensRemoteApiResponse( 41 | request: request, 42 | status: error != nil ? .badRequest : .success, 43 | metadata: [:], 44 | body: data) 45 | 46 | responseHandler(.answered, apiResponse) 47 | } 48 | 49 | task.resume() 50 | 51 | return URLRequestRemoteApiServiceCall(task: task) 52 | } 53 | 54 | private func url(request: LensRemoteApiRequest) -> URL? { 55 | var components = URLComponents() 56 | components.host = Constants.host 57 | components.path = "/" + request.endpointId 58 | components.scheme = Constants.scheme 59 | return components.url 60 | } 61 | 62 | } 63 | 64 | class URLRequestRemoteApiServiceCall: NSObject, LensRemoteApiServiceCall { 65 | 66 | let task: URLSessionDataTask 67 | 68 | let status: LensRemoteApiServiceCallStatus = .ongoing 69 | 70 | init(task: URLSessionDataTask) { 71 | self.task = task 72 | super.init() 73 | } 74 | 75 | func cancelRequest() { 76 | task.cancel() 77 | } 78 | 79 | } 80 | 81 | class IgnoredRemoteApiServiceCall: NSObject, LensRemoteApiServiceCall { 82 | let status: LensRemoteApiServiceCallStatus = .ignored 83 | 84 | func cancelRequest() { 85 | // no-op 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Application/Debug/APITokenView.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | 3 | struct APITokenView: View { 4 | 5 | @Binding var apiToken: String 6 | @State var initialAPIToken: String 7 | 8 | init(apiToken: Binding) { 9 | _apiToken = apiToken 10 | self.initialAPIToken = apiToken.wrappedValue 11 | } 12 | 13 | var body: some View { 14 | List { 15 | Section { 16 | if #available(iOS 14, *) { 17 | TextEditor(text: $apiToken) 18 | .frame(minHeight: 250) 19 | } else { 20 | TextField("camera_kit_update_api_token_placeholder", text: $apiToken) 21 | } 22 | } 23 | Section { 24 | if apiToken != initialAPIToken { 25 | Text("camera_kit_update_api_token_restart_prompt") 26 | Button { 27 | exit(0) 28 | } label: { 29 | Text("camera_kit_update_api_token_quit_button") 30 | .bold() 31 | .foregroundColor(.red) 32 | } 33 | } 34 | } 35 | } 36 | .navigationBarItems(trailing: Button("camera_kit_debug_reset_button", action: { 37 | apiToken = ApplicationInfo.apiToken! 38 | }).foregroundColor(.red)) 39 | .ck_navigationTitle("camera_kit_update_api_token_button") 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Application/Debug/DebugStore.swift: -------------------------------------------------------------------------------- 1 | import Combine 2 | import SCSDKCameraKit 3 | 4 | /// Protocol for DebugStore to get around iOS 12 compilation warnings. 5 | protocol DebugStoreProtocol { 6 | 7 | /// The API token to use for requests. Defaults to the Info.plist's API token. 8 | var apiToken: String { get set } 9 | 10 | /// The group IDs to use for lens fetching. 11 | var groupIDs: [String] { get set } 12 | 13 | /// Handles a deep link for configuration. 14 | /// - Parameter url: a configuration deep link, in the format of: 15 | /// camerakitsample://debug/apitoken/set/yourtokenhere 16 | /// camerakitsample://debug/groups/set/group1,group2,etc 17 | func processDeepLink(_ url: URL) 18 | } 19 | 20 | class DebugStore: ObservableObject, DebugStoreProtocol { 21 | 22 | @Published var apiToken: String = ApplicationInfo.apiToken! 23 | @Published var groupIDs: [String] = [] 24 | let defaultGroupIDs: [String] 25 | private var cancellable: Set = [] 26 | 27 | /// Initializes a debug store with a default set of Group IDs. 28 | /// - Parameter defaultGroupIDs: The default group IDs to populate the configuration screen with. 29 | init(defaultGroupIDs: [String]) { 30 | self.defaultGroupIDs = defaultGroupIDs 31 | assert(apiToken != "REPLACE-THIS-WITH-YOUR-OWN-APP-SPECIFIC-VALUE", "Please specify API Token in Info.plist (SCCameraKitAPIToken)") 32 | apiToken = UserDefaults.standard.string(forKey: Constants.apiTokenDefaultsKey) ?? apiToken 33 | groupIDs = UserDefaults.standard.stringArray(forKey: Constants.lensGroupIDsDefaultsKey) ?? defaultGroupIDs 34 | $apiToken.sink { newValue in 35 | UserDefaults.standard.set(newValue, forKey: Constants.apiTokenDefaultsKey) 36 | }.store(in: &cancellable) 37 | $groupIDs.sink { newValue in 38 | UserDefaults.standard.set(newValue, forKey: Constants.lensGroupIDsDefaultsKey) 39 | }.store(in: &cancellable) 40 | } 41 | 42 | func processDeepLink(_ url: URL) { 43 | guard url.host?.lowercased() == "debug" else { return } 44 | let path = Array(url.pathComponents.dropFirst()) 45 | guard path[1].localizedLowercase == "set" else { return } 46 | switch path.first?.localizedLowercase { 47 | case "apitoken": 48 | apiToken = path[2] 49 | exit(0) 50 | case "groups": 51 | var groups = path[2].split(separator: ",").map(String.init) 52 | if !groups.contains(SCCameraKitLensRepositoryBundledGroup) { 53 | groups.insert(SCCameraKitLensRepositoryBundledGroup, at: 0) 54 | } 55 | groupIDs = groups 56 | default: 57 | return 58 | } 59 | } 60 | 61 | } 62 | 63 | extension DebugStore { 64 | 65 | private enum Constants { 66 | static let lensGroupIDsDefaultsKey = "com.snap.camerakit.sample.lensGroupIDsKey" 67 | static let apiTokenDefaultsKey = "com.snap.camerakit.sample.apiTokenKey" 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Application/Debug/DebugView.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | 3 | struct DebugView: View { 4 | 5 | @ObservedObject var store: DebugStore 6 | 7 | var body: some View { 8 | List { 9 | NavigationLink("camera_kit_update_api_token_button") { 10 | APITokenView(apiToken: $store.apiToken) 11 | } 12 | NavigationLink("camera_kit_update_lens_group_button") { 13 | LensGroupIDsView(defaultGroupIDs: store.defaultGroupIDs, groupIDs: $store.groupIDs) 14 | } 15 | } 16 | .ck_navigationTitle("Debug") 17 | } 18 | 19 | } 20 | 21 | extension View { 22 | 23 | func ck_navigationTitle(_ titleKey: LocalizedStringKey) -> some View { 24 | if #available(iOS 14, *) { 25 | return navigationTitle(titleKey) 26 | } else { 27 | return navigationBarTitle(titleKey) 28 | } 29 | } 30 | 31 | func ck_onSubmit(_ action: @escaping (() -> Void)) -> some View { 32 | if #available(iOS 15, *) { 33 | return onSubmit(action) 34 | } else { 35 | return self 36 | } 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Application/Debug/LensGroupIDsView.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | 3 | struct LensGroupIDsView: View { 4 | 5 | let defaultGroupIDs: [String] 6 | @Binding var groupIDs: [String] 7 | @State var newID = "" 8 | 9 | var body: some View { 10 | List { 11 | Section { 12 | ForEach(groupIDs, id: \.self) { id in 13 | Text(id) 14 | } 15 | .onMove { source, destination in 16 | groupIDs.move(fromOffsets: source, toOffset: destination) 17 | } 18 | .onDelete { offsets in 19 | groupIDs.remove(atOffsets: offsets) 20 | } 21 | TextField("camera_kit_group_id_textfield_placeholder", text: $newID) 22 | .ck_onSubmit(save) 23 | } 24 | Section { 25 | if !newID.isEmpty { 26 | Button("camera_kit_group_id_add_button", action: save) 27 | } 28 | } 29 | } 30 | .navigationBarItems(trailing: Button("camera_kit_debug_reset_button", action: { 31 | groupIDs = defaultGroupIDs 32 | }).foregroundColor(.red)) 33 | .navigationBarTitle("camera_kit_update_lens_group_button") 34 | } 35 | 36 | func save() { 37 | groupIDs.append(newID) 38 | newID = "" 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Application/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_debug_nav_title" = "Debug"; 6 | "camera_kit_done_button" = "Done"; 7 | "camera_kit_group_id_textfield_placeholder" = "New Group ID"; 8 | "camera_kit_group_id_add_button" = "Add"; 9 | "camera_kit_update_api_token_button" = "API Token"; 10 | "camera_kit_update_api_token_placeholder" = "API Token"; 11 | "camera_kit_update_api_token_restart_prompt" = "Restart Camera Kit Sample to use the new API Token."; 12 | "camera_kit_update_api_token_quit_button" = "Quit"; 13 | "camera_kit_update_lens_group_button" = "Lens Group IDs"; 14 | "camera_kit_debug_reset_button" = "Reset"; 15 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "iPhoneNotification@2x.png", 5 | "idiom" : "iphone", 6 | "scale" : "2x", 7 | "size" : "20x20" 8 | }, 9 | { 10 | "filename" : "iPhoneNotification@3x.png", 11 | "idiom" : "iphone", 12 | "scale" : "3x", 13 | "size" : "20x20" 14 | }, 15 | { 16 | "filename" : "iPhoneSettings@2x.png", 17 | "idiom" : "iphone", 18 | "scale" : "2x", 19 | "size" : "29x29" 20 | }, 21 | { 22 | "filename" : "iPhoneSettings@3x.png", 23 | "idiom" : "iphone", 24 | "scale" : "3x", 25 | "size" : "29x29" 26 | }, 27 | { 28 | "filename" : "iPhoneSpotlight@2x.png", 29 | "idiom" : "iphone", 30 | "scale" : "2x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "filename" : "iPhoneSpotlight@3x.png", 35 | "idiom" : "iphone", 36 | "scale" : "3x", 37 | "size" : "40x40" 38 | }, 39 | { 40 | "filename" : "iPhone@2x.png", 41 | "idiom" : "iphone", 42 | "scale" : "2x", 43 | "size" : "60x60" 44 | }, 45 | { 46 | "filename" : "iPhone@3x.png", 47 | "idiom" : "iphone", 48 | "scale" : "3x", 49 | "size" : "60x60" 50 | }, 51 | { 52 | "filename" : "iPadNotification@1x.png", 53 | "idiom" : "ipad", 54 | "scale" : "1x", 55 | "size" : "20x20" 56 | }, 57 | { 58 | "filename" : "iPadNotification@2x.png", 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "20x20" 62 | }, 63 | { 64 | "filename" : "iPadSettings@1x-1.png", 65 | "idiom" : "ipad", 66 | "scale" : "1x", 67 | "size" : "29x29" 68 | }, 69 | { 70 | "filename" : "iPadSettings@2x.png", 71 | "idiom" : "ipad", 72 | "scale" : "2x", 73 | "size" : "29x29" 74 | }, 75 | { 76 | "filename" : "iPadSpotlight@1x.png", 77 | "idiom" : "ipad", 78 | "scale" : "1x", 79 | "size" : "40x40" 80 | }, 81 | { 82 | "filename" : "iPadSpotlight@2x.png", 83 | "idiom" : "ipad", 84 | "scale" : "2x", 85 | "size" : "40x40" 86 | }, 87 | { 88 | "filename" : "iPad@1x.png", 89 | "idiom" : "ipad", 90 | "scale" : "1x", 91 | "size" : "76x76" 92 | }, 93 | { 94 | "filename" : "iPad@2x.png", 95 | "idiom" : "ipad", 96 | "scale" : "2x", 97 | "size" : "76x76" 98 | }, 99 | { 100 | "filename" : "iPadPro@2x.png", 101 | "idiom" : "ipad", 102 | "scale" : "2x", 103 | "size" : "83.5x83.5" 104 | }, 105 | { 106 | "idiom" : "ios-marketing", 107 | "scale" : "1x", 108 | "size" : "1024x1024" 109 | } 110 | ], 111 | "info" : { 112 | "author" : "xcode", 113 | "version" : 1 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPad@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPad@1x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPad@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPad@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPadNotification@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPadNotification@1x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPadNotification@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPadNotification@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPadPro@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPadPro@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPadSettings@1x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPadSettings@1x-1.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPadSettings@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPadSettings@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPadSpotlight@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPadSpotlight@1x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPadSpotlight@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPadSpotlight@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPhone@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPhone@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPhone@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPhone@3x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPhoneNotification@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPhoneNotification@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPhoneNotification@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPhoneNotification@3x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPhoneSettings@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPhoneSettings@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPhoneSettings@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPhoneSettings@3x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPhoneSpotlight@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPhoneSpotlight@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPhoneSpotlight@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/AppIcon.appiconset/iPhoneSpotlight@3x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/DebugActive.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "DebugActive@2x.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "filename" : "DebugActive@3x.png", 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "author" : "xcode", 20 | "version" : 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/DebugActive.imageset/DebugActive@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/DebugActive.imageset/DebugActive@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/DebugActive.imageset/DebugActive@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/DebugActive.imageset/DebugActive@3x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/PushToDevice.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "PushToDevice@2x.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "filename" : "PushToDevice@3x.png", 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "author" : "xcode", 20 | "version" : 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/PushToDevice.imageset/PushToDevice@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/PushToDevice.imageset/PushToDevice@2x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Assets.xcassets/PushToDevice.imageset/PushToDevice@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/Assets.xcassets/PushToDevice.imageset/PushToDevice@3x.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleURLTypes 20 | 21 | 22 | CFBundleURLSchemes 23 | 24 | camerakitsample 25 | camerakitsandbox 26 | 27 | 28 | 29 | CFBundleTypeRole 30 | Editor 31 | CFBundleURLSchemes 32 | 33 | camerakitsample 34 | 35 | 36 | 37 | CFBundleVersion 38 | $(CURRENT_PROJECT_VERSION) 39 | LSApplicationCategoryType 40 | 41 | LSApplicationQueriesSchemes 42 | 43 | snapchat 44 | 45 | LSRequiresIPhoneOS 46 | 47 | NSCameraUsageDescription 48 | CameraKit Sample app uses the camera to show lenses 49 | NSLocationWhenInUseUsageDescription 50 | CameraKit Sample uses your location for location-aware lenses. 51 | NSMicrophoneUsageDescription 52 | CameraKit Sample app uses the microphone to process and record audio 53 | NSPhotoLibraryAddUsageDescription 54 | CameraKit Sample uses photo library to save captured photos and recorded videos 55 | NSPhotoLibraryUsageDescription 56 | CameraKit Sample uses photo library to save captured photos and recorded videos 57 | SCCameraKitAPIToken 58 | REPLACE-THIS-WITH-YOUR-OWN-APP-SPECIFIC-VALUE 59 | SCSDKClientId 60 | REPLACE-THIS-WITH-YOUR-OWN-APP-SPECIFIC-VALUE 61 | SCSDKRedirectUrl 62 | REPLACE-THIS-WITH-YOUR-OWN-APP-SPECIFIC-VALUE 63 | SCSDKScopes 64 | 65 | https://auth.snapchat.com/oauth2/api/camkit_lens_push_to_device 66 | 67 | UILaunchStoryboardName 68 | LaunchScreen 69 | UIRequiredDeviceCapabilities 70 | 71 | armv7 72 | 73 | UISupportedInterfaceOrientations 74 | 75 | UIInterfaceOrientationPortrait 76 | UIInterfaceOrientationLandscapeLeft 77 | UIInterfaceOrientationLandscapeRight 78 | 79 | UISupportedInterfaceOrientations~ipad 80 | 81 | UIInterfaceOrientationPortrait 82 | UIInterfaceOrientationPortraitUpsideDown 83 | UIInterfaceOrientationLandscapeLeft 84 | UIInterfaceOrientationLandscapeRight 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/lens_icons/a75243b2-55fb-4e8f-8227-2ce6ce43b169.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/lens_icons/a75243b2-55fb-4e8f-8227-2ce6ce43b169.png -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSample/lenses/11660437246.big_mouth.lns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Samples/CameraKitSample/CameraKitSample/lenses/11660437246.big_mouth.lns -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSampleTests/ApplicationInfoTests.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKitSampleTests 3 | 4 | import XCTest 5 | @testable import CameraKitSample 6 | 7 | class ApplicationInfoTests: XCTestCase { 8 | 9 | override func setUp() { 10 | // Put setup code here. This method is called before the invocation of each test method in the class. 11 | } 12 | 13 | override func tearDown() { 14 | // Put teardown code here. This method is called after the invocation of each test method in the class. 15 | } 16 | 17 | func testVersionInfo() { 18 | // Assert `CFBundleShortVersionString` is not nil 19 | XCTAssertNotNil(ApplicationInfo.version) 20 | } 21 | 22 | func testBuildInfo() { 23 | // Assert `CFBundleVersion` is not nil 24 | XCTAssertNotNil(ApplicationInfo.build) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSampleUITests/CameraKitSampleUITests.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKitSample 3 | 4 | import XCTest 5 | 6 | class CameraKitSampleUITests: XCTestCase { 7 | 8 | override func setUp() { 9 | // Put setup code here. This method is called before the invocation of each test method in the class. 10 | 11 | // In UI tests it is usually best to stop immediately when a failure occurs. 12 | continueAfterFailure = false 13 | 14 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 15 | } 16 | 17 | override func tearDown() { 18 | // Put teardown code here. This method is called after the invocation of each test method in the class. 19 | } 20 | 21 | func testExample() { 22 | // UI tests must launch the application that they test. 23 | let app = XCUIApplication() 24 | app.launch() 25 | 26 | // Use recording to get started writing UI tests. 27 | // Use XCTAssert and related functions to verify your tests produce the correct results. 28 | } 29 | 30 | func testLaunchPerformance() { 31 | // This measures how long it takes to launch your application. 32 | measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) { 33 | XCUIApplication().launch() 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Samples/CameraKitSample/CameraKitSampleUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Sources/CameraKitBaseExtension_Wrapper/Dummy.swift: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Sources/CameraKitLoginKitAuth_Wrapper/Dummy.swift: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Sources/CameraKitPushToDeviceExtension_Wrapper/Dummy.swift: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceSwiftUI/CameraButton.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | 3 | import SCSDKCameraKit 4 | import SCSDKCameraKitReferenceUI 5 | import SwiftUI 6 | 7 | /// SwiftUI wrapper for the reference UI camera button. 8 | public struct CameraButton: UIViewRepresentable { 9 | /// A closure to be called when a photo is captured 10 | private let photoCaptureAction: (() -> Void)? 11 | 12 | /// A closure to be called when the user begins recording 13 | private let recordingStartAction: (() -> Void)? 14 | 15 | /// A closure to be called when the user cancels recording. Will be immediately followed by the execution of photoCaptureAction 16 | private let recordingCancelAction: (() -> Void)? 17 | 18 | /// A closure to be called when the user completes recording 19 | private let recordingFinishAction: (() -> Void)? 20 | 21 | /// Initializes the camera button 22 | /// - Parameters: 23 | /// - recordingStart: A closure to be called when the user begins recording 24 | /// - recordingCancel: A closure to be called when the user cancels recording. Will be immediately followed by the execution of photoCaptureAction 25 | /// - recordingFinish: A closure to be called when the user cancels recording. Will be immediately followed by the execution of photoCaptureAction 26 | /// - photoCapture: A closure to be called when a photo is captured 27 | init( 28 | recordingStart: (() -> Void)?, recordingCancel: (() -> Void)?, recordingFinish: (() -> Void)?, 29 | photoCapture: (() -> Void)? 30 | ) { 31 | self.recordingStartAction = recordingStart 32 | self.recordingCancelAction = recordingCancel 33 | self.recordingFinishAction = recordingFinish 34 | self.photoCaptureAction = photoCapture 35 | } 36 | 37 | public func makeCoordinator() -> Coordinator { 38 | Coordinator(self) 39 | } 40 | 41 | public func makeUIView(context: Context) -> some UIView { 42 | let inner = SCSDKCameraKitReferenceUI.CameraButton() 43 | inner.delegate = context.coordinator 44 | return inner 45 | } 46 | 47 | public func updateUIView(_ uiView: UIViewType, context: Context) { 48 | } 49 | } 50 | 51 | public extension CameraButton { 52 | class Coordinator: NSObject, CameraButtonDelegate { 53 | let parent: CameraButton 54 | 55 | init(_ parent: CameraButton) { 56 | self.parent = parent 57 | } 58 | 59 | public func cameraButtonTapped(_ cameraButton: SCSDKCameraKitReferenceUI.CameraButton) { 60 | parent.photoCaptureAction?() 61 | } 62 | 63 | public func cameraButtonHoldBegan(_ cameraButton: SCSDKCameraKitReferenceUI.CameraButton) { 64 | parent.recordingStartAction?() 65 | } 66 | 67 | public func cameraButtonHoldCancelled(_ cameraButton: SCSDKCameraKitReferenceUI.CameraButton) { 68 | parent.recordingCancelAction?() 69 | } 70 | 71 | public func cameraButtonHoldEnded(_ cameraButton: SCSDKCameraKitReferenceUI.CameraButton) { 72 | parent.recordingFinishAction?() 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceSwiftUI/CarouselView.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | 3 | import SCSDKCameraKit 4 | import SCSDKCameraKitReferenceUI 5 | import SwiftUI 6 | 7 | /// SwiftUI wrapper for the reference UI carousel view. 8 | public struct CarouselView: UIViewRepresentable { 9 | /// The lenses that should be visible in the carousel 10 | @Binding var availableLenses: [Lens] 11 | 12 | /// The currently selected lens, if one is selected. 13 | @Binding var selectedLens: Lens? 14 | 15 | public func makeCoordinator() -> Coordinator { 16 | Coordinator(self) 17 | } 18 | 19 | public func makeUIView(context: Context) -> SCSDKCameraKitReferenceUI.CarouselView { 20 | let inner = SCSDKCameraKitReferenceUI.CarouselView() 21 | inner.delegate = context.coordinator 22 | inner.dataSource = context.coordinator 23 | return inner 24 | } 25 | 26 | public func updateUIView(_ uiView: SCSDKCameraKitReferenceUI.CarouselView, context: Context) { 27 | let item = context.coordinator.item(for: selectedLens) 28 | if uiView.selectedItem != item { 29 | uiView.selectItem(item) 30 | } 31 | if context.coordinator.availableLenses.map(\.id) != availableLenses.map(\.id) { 32 | context.coordinator.availableLenses = availableLenses 33 | uiView.reloadData() 34 | } 35 | } 36 | } 37 | 38 | public extension CarouselView { 39 | class Coordinator: NSObject, CarouselViewDelegate, CarouselViewDataSource { 40 | let parent: CarouselView 41 | var availableLenses: [Lens] = [] 42 | 43 | init(_ parent: CarouselView) { 44 | self.parent = parent 45 | } 46 | 47 | // MARK: CarouselViewDelegate 48 | 49 | public func carouselView( 50 | _ view: SCSDKCameraKitReferenceUI.CarouselView, didSelect item: CarouselItem, at index: Int 51 | ) { 52 | if index > 0 { 53 | parent.selectedLens = parent.availableLenses[index - 1] 54 | } else { 55 | parent.selectedLens = nil 56 | } 57 | } 58 | 59 | // MARK: CarouselViewDataSource 60 | 61 | public func itemsForCarouselView(_ view: SCSDKCameraKitReferenceUI.CarouselView) -> [CarouselItem] { 62 | [EmptyItem()] 63 | + availableLenses.map { 64 | item(for: $0) 65 | } 66 | } 67 | 68 | public func item(for lens: Lens?) -> CarouselItem { 69 | guard let lens else { return EmptyItem() } 70 | return CarouselItem(lensId: lens.id, groupId: lens.groupId, imageUrl: lens.iconUrl) 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceSwiftUI/ImagePreviewView.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | 3 | import SCSDKCameraKit 4 | import SCSDKCameraKitReferenceUI 5 | import SwiftUI 6 | 7 | /// SwiftUI wrapper for the reference UI captured image preview view controller. 8 | public struct ImagePreviewView: UIViewControllerRepresentable { 9 | private let image: UIImage 10 | private weak var snapchatDelegate: SnapchatDelegate? 11 | 12 | /// Creates a preview view. 13 | /// - Parameters: 14 | /// - image: the captured image to show 15 | /// - snapchatDelegate: the Snapchat delegate 16 | public init(image: UIImage, snapchatDelegate: SnapchatDelegate?) { 17 | self.image = image 18 | self.snapchatDelegate = snapchatDelegate 19 | } 20 | 21 | public func makeUIViewController(context: Context) -> some UIViewController { 22 | let inner = ImagePreviewViewController(image: image) 23 | inner.snapchatDelegate = snapchatDelegate 24 | return inner 25 | } 26 | 27 | public func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) { 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceSwiftUI/MediaPickerView.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | 3 | import SCSDKCameraKit 4 | import SCSDKCameraKitReferenceUI 5 | import SwiftUI 6 | 7 | /// SwiftUI wrapper for the reference UI media picker. 8 | public struct MediaPickerView: View { 9 | private let provider: LensMediaPickerProvider 10 | @State private var hidden: Bool = true 11 | 12 | /// Initializes the media picker view with a media picker provider 13 | /// - Parameter provider: the provider to use 14 | public init(provider: LensMediaPickerProvider) { 15 | self.provider = provider 16 | } 17 | 18 | public var body: some View { 19 | _MediaPickerView(provider: provider, hidden: $hidden) 20 | .padding([.leading, .trailing]) 21 | } 22 | } 23 | 24 | private struct _MediaPickerView: UIViewRepresentable { 25 | private let provider: LensMediaPickerProvider 26 | fileprivate let inner = SCSDKCameraKitReferenceUI.MediaPickerView() 27 | @Binding var hidden: Bool 28 | 29 | init(provider: LensMediaPickerProvider, hidden: Binding) { 30 | self.provider = provider 31 | self._hidden = hidden 32 | } 33 | 34 | func makeCoordinator() -> Coordinator { 35 | Coordinator(self) 36 | } 37 | 38 | func makeUIView(context: Context) -> SCSDKCameraKitReferenceUI.MediaPickerView { 39 | provider.uiDelegate = context.coordinator 40 | inner.provider = provider 41 | return inner 42 | } 43 | 44 | public func updateUIView(_ uiView: SCSDKCameraKitReferenceUI.MediaPickerView, context: Context) { 45 | } 46 | } 47 | 48 | extension _MediaPickerView { 49 | class Coordinator: NSObject, LensMediaPickerProviderUIDelegate { 50 | let parent: _MediaPickerView 51 | 52 | init(_ parent: _MediaPickerView) { 53 | self.parent = parent 54 | } 55 | 56 | func mediaPickerProviderRequestedUIPresentation(_ provider: LensMediaPickerProvider) { 57 | parent.inner.mediaPickerProviderRequestedUIPresentation(provider) 58 | parent.hidden = false 59 | } 60 | 61 | func mediaPickerProviderRequestedUIDismissal(_ provider: LensMediaPickerProvider) { 62 | parent.inner.mediaPickerProviderRequestedUIDismissal(provider) 63 | parent.hidden = true 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceSwiftUI/PreviewView.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | 3 | import SCSDKCameraKit 4 | import SwiftUI 5 | 6 | /// SwiftUI wrapper for the CameraKit preview view. 7 | public struct PreviewView: UIViewRepresentable { 8 | private let inner = SCSDKCameraKit.PreviewView() 9 | private let cameraKit: CameraKitProtocol 10 | 11 | /// Initializes a preview view and connects it to a CameraKit session as an output 12 | /// - Parameter cameraKit: the session to attach the preview view as an output to 13 | /// - Parameter automaticallyConfiguresTouchHandler: whether or not touch handling should automatically be configured for the view 14 | public init(cameraKit: CameraKitProtocol, automaticallyConfiguresTouchHandler: Bool = true) { 15 | self.cameraKit = cameraKit 16 | inner.automaticallyConfiguresTouchHandler = automaticallyConfiguresTouchHandler 17 | } 18 | 19 | public func makeUIView(context: Context) -> some UIView { 20 | cameraKit.add(output: inner) 21 | return inner 22 | } 23 | 24 | public func updateUIView(_ uiView: UIViewType, context: Context) { 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceSwiftUI/VideoPreviewView.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | 3 | import SCSDKCameraKit 4 | import SCSDKCameraKitReferenceUI 5 | import SwiftUI 6 | 7 | /// SwiftUI wrapper for the reference UI captured video preview view controller. 8 | public struct VideoPreviewView: UIViewControllerRepresentable { 9 | private let video: URL 10 | private weak var snapchatDelegate: SnapchatDelegate? 11 | 12 | /// Creates a preview view. 13 | /// - Parameters: 14 | /// - video: the url for the recorded video to show 15 | /// - snapchatDelegate: the Snapchat delegate 16 | public init(video: URL, snapchatDelegate: SnapchatDelegate?) { 17 | self.video = video 18 | self.snapchatDelegate = snapchatDelegate 19 | } 20 | 21 | public func makeUIViewController(context: Context) -> some UIViewController { 22 | let inner = VideoPreviewViewController(videoUrl: video) 23 | inner.snapchatDelegate = snapchatDelegate 24 | return inner 25 | } 26 | 27 | public func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) { 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/CameraUI/Flash/RingLight/RingLightColorSelectionViewCell.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // SCSDKCameraKitReferenceUI 3 | 4 | import UIKit 5 | 6 | public class RingLightColorSelectionViewCell: UICollectionViewCell { 7 | public static let reuseIdentifer = "ringLightColorSelectionViewCell" 8 | 9 | // MARK: Layers 10 | 11 | /// Inner circle with the color option the cell represents. 12 | private lazy var innerCircleLayer: CAShapeLayer = { 13 | let innerCirclePath = UIBezierPath( 14 | arcCenter: CGPoint(x: bounds.midX, y: bounds.midY), 15 | radius: 16, 16 | startAngle: 0, 17 | endAngle: 2.0 * .pi, 18 | clockwise: true 19 | ) 20 | 21 | let layer = CAShapeLayer() 22 | layer.path = innerCirclePath.cgPath 23 | 24 | return layer 25 | }() 26 | 27 | /// Outer circle that is used as a "highlight" when this color option is selected. 28 | private lazy var outerCircleLayer: CAShapeLayer = { 29 | let outerCirclePath = UIBezierPath( 30 | arcCenter: CGPoint(x: bounds.midX, y: bounds.midY), 31 | radius: 20, 32 | startAngle: 0, 33 | endAngle: 2.0 * .pi, 34 | clockwise: true 35 | ) 36 | 37 | let layer = CAShapeLayer() 38 | layer.path = outerCirclePath.cgPath 39 | layer.isHidden = true 40 | layer.fillColor = UIColor.white.withAlphaComponent(0.5).cgColor 41 | 42 | return layer 43 | }() 44 | 45 | // MARK: Public 46 | 47 | /// Used to set the color option that the cell represents. 48 | /// - Parameter color: The color to set for the cell. 49 | public func setColor(_ color: UIColor) { 50 | innerCircleLayer.fillColor = color.cgColor 51 | } 52 | 53 | /// Used to highlight the color option that this cell represents when selected. 54 | public func highlight() { 55 | outerCircleLayer.isHidden = false 56 | } 57 | 58 | /// Remove the highlight from this cell. 59 | public func unhighlight() { 60 | outerCircleLayer.isHidden = true 61 | } 62 | 63 | override public func layoutSubviews() { 64 | super.layoutSubviews() 65 | 66 | [outerCircleLayer, innerCircleLayer].forEach(layer.addSublayer) 67 | } 68 | 69 | override public var intrinsicContentSize: CGSize { 70 | CGSize(width: 48, height: 48) 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Carousel/CarouselCollectionViewCell.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import UIKit 5 | 6 | /// Carousel collection view cell which represents a single lens item/icon 7 | public class CarouselCollectionViewCell: UICollectionViewCell { 8 | public let imageView: UIImageView = { 9 | let view = UIImageView() 10 | view.translatesAutoresizingMaskIntoConstraints = false 11 | return view 12 | }() 13 | 14 | /// Activity indicator view that should activate when lens content is loading 15 | public let activityIndicatorView: UIActivityIndicatorView = { 16 | let view = UIActivityIndicatorView() 17 | view.style = .medium 18 | view.color = .white 19 | view.translatesAutoresizingMaskIntoConstraints = false 20 | return view 21 | }() 22 | 23 | public init() { 24 | super.init(frame: .zero) 25 | commonInit() 26 | } 27 | 28 | override public init(frame: CGRect) { 29 | super.init(frame: frame) 30 | commonInit() 31 | } 32 | 33 | public required init?(coder: NSCoder) { 34 | super.init(coder: coder) 35 | commonInit() 36 | } 37 | 38 | private func commonInit() { 39 | backgroundColor = .clear 40 | isAccessibilityElement = true 41 | contentView.addSubview(imageView) 42 | contentView.addSubview(activityIndicatorView) 43 | setupConstraints() 44 | } 45 | 46 | private func setupConstraints() { 47 | NSLayoutConstraint.activate([ 48 | imageView.topAnchor.constraint(equalTo: contentView.topAnchor), 49 | imageView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor), 50 | imageView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor), 51 | imageView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor), 52 | activityIndicatorView.centerXAnchor.constraint(equalTo: contentView.centerXAnchor), 53 | activityIndicatorView.centerYAnchor.constraint(equalTo: contentView.centerYAnchor), 54 | ]) 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Carousel/CarouselCollectionViewLayout.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import UIKit 5 | 6 | /// Delegate for custom carousel collection view layout 7 | public protocol CarouselCollectionViewLayoutDelegate: AnyObject { 8 | /// This method is called when user stops scrolling and layout will target the correct lens to land at 9 | /// - Parameters: 10 | /// - layout: carousel collection view layout instance 11 | /// - index: index of item that it will land at 12 | func carouselLayout(_ layout: CarouselCollectionViewLayout, willTargetIndex index: Int) 13 | } 14 | 15 | /// Data source for custom carousel collection view layout 16 | public protocol CarouselCollectionViewLayoutDataSource: AnyObject { 17 | /// Method to provide any sort of transform that should be applied to the carousel cell 18 | /// - Parameters: 19 | /// - layout: carousel collection view layout instance 20 | /// - indexPath: index path of cell 21 | func carouselLayout(_ layout: CarouselCollectionViewLayout, transformForItemAt indexPath: IndexPath) 22 | -> CGAffineTransform 23 | } 24 | 25 | /// Custom collection view layout for carousel collection view 26 | public class CarouselCollectionViewLayout: UICollectionViewFlowLayout { 27 | /// Weak ref to carousel layout delegate 28 | public weak var delegate: CarouselCollectionViewLayoutDelegate? 29 | 30 | /// Weak ref to carousel layout data source 31 | public weak var dataSource: CarouselCollectionViewLayoutDataSource? 32 | 33 | /// Override flow layout target content offset to land at a specific item (for the paging effect) 34 | /// - Parameters: 35 | /// - proposedContentOffset: proposed content offset of flow layout to land at 36 | /// - velocity: scrolling velocity of collection view 37 | override public func targetContentOffset( 38 | forProposedContentOffset proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint 39 | ) -> CGPoint { 40 | guard let collectionView else { return proposedContentOffset } 41 | 42 | // offset the left padding 43 | let offset = proposedContentOffset.x + collectionView.contentInset.left 44 | // page index is offset divided by the item view size (height + spacing / 2.0) 45 | let index = offset / (itemSize.height + minimumInteritemSpacing) 46 | let pageIndex = index.rounded() 47 | 48 | delegate?.carouselLayout(self, willTargetIndex: Int(pageIndex)) 49 | 50 | // new target offset is page index multiplied by content size + spacing 51 | // also need to make sure to add back the left padding 52 | let newTarget = 53 | pageIndex * (itemSize.height + minimumInteritemSpacing) 54 | - collectionView.contentInset.left 55 | return CGPoint(x: newTarget, y: proposedContentOffset.y) 56 | } 57 | 58 | override public func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { 59 | guard let list = super.layoutAttributesForElements(in: rect) else { return nil } 60 | return list.map { attributes in 61 | guard let ret = attributes.copy() as? UICollectionViewLayoutAttributes else { 62 | return attributes 63 | } 64 | 65 | if let transform = dataSource?.carouselLayout(self, transformForItemAt: ret.indexPath) { 66 | ret.transform = transform 67 | } 68 | 69 | return ret 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Carousel/CarouselImageLoader.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import UIKit 5 | 6 | /// Protocol used to load an image from url 7 | public protocol CarouselImageLoader: AnyObject { 8 | /// Load image from url 9 | /// - Parameters: 10 | /// - url: image url 11 | /// - completion: callback with image on success or error on failure 12 | func loadImage(url: URL, completion: ((_ image: UIImage?, _ error: Error?) -> Void)?) 13 | 14 | /// Load image from url 15 | /// - Parameters: 16 | /// - url: image url 17 | /// - cachePolicy: cache policy for the requested image data 18 | /// - queue: queue to call completion on 19 | /// - completion: callback with image on success or error on failure 20 | func loadImage( 21 | url: URL, 22 | cachePolicy: URLRequest.CachePolicy, 23 | queue: DispatchQueue, 24 | completion: ((UIImage?, Error?) -> Void)? 25 | ) 26 | 27 | /// Cancels image loading for a given url 28 | func cancelImageLoad(from url: URL) 29 | } 30 | 31 | /// Default image loader class which uses a URLSession to load images 32 | public class DefaultCarouselImageLoader: CarouselImageLoader { 33 | public let urlSession: URLSession 34 | fileprivate var tasks: [URL: URLSessionDataTask] = [:] 35 | fileprivate let taskQueue = DispatchQueue(label: "com.snap.camerakit.referenceui.imageloader") 36 | 37 | public init(urlSession: URLSession = .shared) { 38 | self.urlSession = urlSession 39 | } 40 | 41 | public func loadImage(url: URL, completion: ((UIImage?, Error?) -> Void)?) { 42 | loadImage(url: url, queue: .main, completion: completion) 43 | } 44 | 45 | public func loadImage( 46 | url: URL, 47 | cachePolicy: URLRequest.CachePolicy = .useProtocolCachePolicy, 48 | queue: DispatchQueue, 49 | completion: ((UIImage?, Error?) -> Void)? 50 | ) { 51 | let request = URLRequest(url: url, cachePolicy: cachePolicy) 52 | let task = urlSession.dataTask(with: request) { [weak self] data, _, error in 53 | self?.removeTask(url: url) 54 | guard 55 | let data, 56 | let image = UIImage(data: data) 57 | else { 58 | queue.async { 59 | completion?(nil, error) 60 | } 61 | return 62 | } 63 | queue.async { 64 | completion?(image, nil) 65 | } 66 | } 67 | 68 | addTask(task, for: url) 69 | task.resume() 70 | } 71 | 72 | public func cancelImageLoad(from url: URL) { 73 | taskQueue.async { 74 | self.tasks[url]?.cancel() 75 | self.tasks[url] = nil 76 | } 77 | } 78 | 79 | fileprivate func addTask(_ task: URLSessionDataTask, for url: URL) { 80 | taskQueue.async { 81 | self.tasks[url] = task 82 | } 83 | } 84 | 85 | fileprivate func removeTask(url: URL) { 86 | taskQueue.async { 87 | self.tasks[url] = nil 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Carousel/CarouselItem.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import UIKit 5 | 6 | /// This is the carousel item view model which represents a specific lens icon 7 | public class CarouselItem: Identifiable, Equatable { 8 | /// id for carousel item 9 | public let id: String 10 | 11 | /// lens id 12 | public let lensId: String 13 | 14 | /// group id lens belongs to 15 | public let groupId: String 16 | 17 | /// image url for lens icon 18 | public let imageUrl: URL? 19 | 20 | /// downloaded image for lens icon 21 | public var image: UIImage? 22 | 23 | /// Designated init for a carousel item 24 | /// - Parameters: 25 | /// - lensId: lens id 26 | /// - groupId: group id that lens belongs to 27 | /// - imageUrl: optional image url of lens icon 28 | /// - image: optional loaded UIImage of icon 29 | public init(lensId: String, groupId: String, imageUrl: URL? = nil, image: UIImage? = nil) { 30 | self.id = lensId + groupId 31 | self.lensId = lensId 32 | self.groupId = groupId 33 | self.imageUrl = imageUrl 34 | self.image = image 35 | } 36 | 37 | public static func == (lhs: CarouselItem, rhs: CarouselItem) -> Bool { 38 | lhs.id == rhs.id 39 | } 40 | } 41 | 42 | /// Concrete class for an empty item (clear camera button) 43 | public class EmptyItem: CarouselItem { 44 | public init() { 45 | super.init( 46 | lensId: "empty", 47 | groupId: "empty", 48 | imageUrl: nil, 49 | image: UIImage(named: "ck_lens_empty", in: BundleHelper.resourcesBundle, compatibleWith: nil) 50 | ) 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Helper/BundleHelper.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import Foundation 5 | 6 | /// Internal helper to deal with resources bundle 7 | public class BundleHelper { 8 | private enum Constants { 9 | static let bundleName = "CameraKitReferenceUI" 10 | static let bundleExtension = "bundle" 11 | } 12 | 13 | /// Internal helper computed property to get correct resources bundle 14 | /// (ie. if pods, look for bundle inside main bundle) 15 | public class var resourcesBundle: Bundle { 16 | #if SWIFT_PACKAGE 17 | return .module 18 | #else 19 | let bundle = Bundle(for: self) 20 | 21 | guard 22 | let resourcesUrl = bundle.url( 23 | forResource: Constants.bundleName, withExtension: Constants.bundleExtension 24 | ), 25 | let resourcesBundle = Bundle(url: resourcesUrl) 26 | else { 27 | return bundle 28 | } 29 | 30 | return resourcesBundle 31 | #endif 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Helper/ButtonShadowHelper.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // SCSDKCameraKitReferenceUI 3 | 4 | import UIKit 5 | 6 | /// Helper to apply shadows to buttons. 7 | public extension UIButton { 8 | /// Applies a shadow designed for camera action buttons. 9 | func applyCameraActionButtonShadow() { 10 | layer.shadowColor = UIColor.black.cgColor 11 | layer.shadowOpacity = 0.45 12 | layer.shadowRadius = 2 13 | layer.shadowOffset = CGSize(width: 0, height: 1) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Helper/ControlDismissalHintHelper.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // SCSDKCameraKitReferenceUI 3 | 4 | import UIKit 5 | 6 | /// Helper to produce a dismissal hint for various camera action controls. 7 | public extension UILabel { 8 | /// Produces a dismissal hint label for the control. 9 | /// - Returns: The dismissal hint label. 10 | static func controlDismissalHint() -> UILabel { 11 | let label = UILabel() 12 | label.textColor = .white.withAlphaComponent(0.65) 13 | label.font = UIFont.sc_mediumFont(size: 12) 14 | label.text = CameraKitLocalizedString(key: "camera_kit_tap_to_dismiss", comment: "") 15 | label.textAlignment = .center 16 | label.layer.shadowColor = UIColor.black.cgColor 17 | label.layer.shadowOpacity = 0.45 18 | label.layer.shadowRadius = 2 19 | label.layer.shadowOffset = CGSize(width: 0, height: 1) 20 | 21 | return label 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Helper/ImageHighlightHelper.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // SCSDKCameraKitReferenceUI 3 | 4 | import UIKit 5 | 6 | /// Helper to produce highlighted versions of some camera action button images. 7 | extension UIImage { 8 | /// Produces a version of the image that is subtracted from a circle with the given radius and color. 9 | /// - Parameters: 10 | /// - radius: The radius of the circle to subtract the image from. 11 | /// - color: The color of the circle to subtract the image from. 12 | /// - Returns: The image subtracted from the circle with the provided radius and color. 13 | public func circleHighlightedImage(radius: CGFloat, color: UIColor = .white) -> UIImage? { 14 | guard let circleImage = UIImage.circleImage(radius: radius, color: color) else { return nil } 15 | return subtractedImage(baseImage: circleImage) 16 | } 17 | 18 | /// Produces an image of a circle with the given radius and color. 19 | /// - Parameters: 20 | /// - radius: The radius of the circle. 21 | /// - color: The color of the circle. 22 | /// - Returns: The image of the circle with the provided radius and color. 23 | private static func circleImage(radius: CGFloat, color: UIColor = .white) -> UIImage? { 24 | let circlePath = UIBezierPath( 25 | arcCenter: CGPoint(x: radius, y: radius), 26 | radius: radius, 27 | startAngle: 0, 28 | endAngle: 2.0 * .pi, 29 | clockwise: true 30 | ) 31 | 32 | let circleLayer = CAShapeLayer() 33 | circleLayer.path = circlePath.cgPath 34 | 35 | let pathBounds = circlePath.cgPath.boundingBoxOfPath 36 | let shapeFrame = CGRect( 37 | x: pathBounds.origin.x, 38 | y: pathBounds.origin.y, 39 | width: pathBounds.size.width, 40 | height: pathBounds.size.height 41 | ) 42 | 43 | circleLayer.fillColor = color.cgColor 44 | circleLayer.bounds = shapeFrame 45 | circleLayer.frame = circleLayer.bounds 46 | 47 | let renderer = UIGraphicsImageRenderer(size: circleLayer.frame.size) 48 | return renderer.image(actions: { circleLayer.render(in: $0.cgContext) }) 49 | } 50 | 51 | /// Subtracts the image from the center of the provided base image. 52 | /// - Parameter baseImage: The image from which the image is subtracted from. 53 | /// - Returns: The subtracted version of the image. 54 | private func subtractedImage(baseImage: UIImage) -> UIImage? { 55 | UIGraphicsImageRenderer(size: baseImage.size).image(actions: { context in 56 | baseImage.draw(at: .zero) 57 | draw( 58 | at: CGPoint(x: (baseImage.size.width - size.width) / 2, y: (baseImage.size.height - size.height) / 2), 59 | blendMode: .destinationOut, 60 | alpha: 1.0 61 | ) 62 | }) 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Helper/OutputSizeHelper.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // SCSDKCameraKitReferenceUI 3 | 4 | import AVFoundation 5 | import Foundation 6 | 7 | /// Provides helper functions to determine output sizes given input sizes and other constraints (aspect ratio, orientation, etc.) 8 | public enum OutputSizeHelper { 9 | /// Returns the size normalized to a new aspect ratio and orientation. 10 | /// For example, given an input size of 1080x1920 and aspect ratio of 0.462 and portrait orientation, 11 | /// this will return a new size of 887x1920. 12 | /// - Parameters: 13 | /// - size: The original input size to normalize. 14 | /// - aspectRatio: The aspect ratio to normalize the output size to. 15 | /// - orientation: The orientation of the input size (defaults to portrait). 16 | /// - Returns: The new size normalized to the aspect ratio. 17 | public static func normalizedSize( 18 | for size: CGSize, aspectRatio: CGFloat, orientation: AVCaptureVideoOrientation = .portrait 19 | ) -> CGSize { 20 | var height = orientation == .portrait ? size.height : size.width 21 | var width = orientation == .portrait ? size.width : size.height 22 | 23 | if orientation == .landscapeLeft || orientation == .landscapeRight { 24 | if height > width * aspectRatio { 25 | height = width * aspectRatio 26 | } else { 27 | width = height / aspectRatio 28 | } 29 | } else { 30 | if width > height * aspectRatio { 31 | width = height * aspectRatio 32 | } else { 33 | height = width / aspectRatio 34 | } 35 | } 36 | 37 | return CGSize(width: width, height: height) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Helper/UIColor+Hex.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import UIKit 5 | 6 | public extension UIColor { 7 | convenience init(hex: UInt, alpha: CGFloat = 1.0) { 8 | self.init( 9 | red: CGFloat((hex & 0xFF0000) >> 16) / 255.0, 10 | green: CGFloat((hex & 0x00FF00) >> 8) / 255.0, 11 | blue: CGFloat((hex & 0x0000FF) >> 0) / 255.0, 12 | alpha: alpha 13 | ) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Helper/UIFont+SCTypography.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // SCSDKCameraKitReferenceUI 3 | 4 | import UIKit 5 | 6 | /// Provides access to Snapchat typography in all supported weights. 7 | public extension UIFont { 8 | static func sc_ultraLightFont(size: CGFloat) -> UIFont? { 9 | UIFont(name: "AvenirNext-UltraLight", size: size) 10 | } 11 | 12 | static func sc_regularFont(size: CGFloat) -> UIFont? { 13 | UIFont(name: "AvenirNext-Regular", size: size) 14 | } 15 | 16 | static func sc_mediumFont(size: CGFloat) -> UIFont? { 17 | UIFont(name: "AvenirNext-Medium", size: size) 18 | } 19 | 20 | static func sc_demiBoldFont(size: CGFloat) -> UIFont? { 21 | UIFont(name: "AvenirNext-DemiBold", size: size) 22 | } 23 | 24 | static func sc_boldFont(size: CGFloat) -> UIFont? { 25 | UIFont(name: "AvenirNext-Bold", size: size) 26 | } 27 | 28 | static func sc_heavyFont(size: CGFloat) -> UIFont? { 29 | UIFont(name: "AvenirNext-Heavy", size: size) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Helper/UITapGestureRecognizer+AVCaptureDevice.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // SCSDKCameraKitReferenceUI 3 | 4 | import Foundation 5 | import UIKit 6 | 7 | extension UITapGestureRecognizer { 8 | /// Converts a point in a view to the coordinate system used by AVCaptureDevice 9 | /// AVCaptureDevice uses a coordinate system where (0, 0) is the top left and (1.0, 1.0) is the bottom right if the device 10 | /// is in landscape orientation with the home button on the right 11 | var captureDevicePoint: CGPoint? { 12 | guard let view else { return nil } 13 | 14 | var interfaceOrientation = UIApplication.shared.statusBarOrientation 15 | if 16 | #available(iOS 13, *), 17 | let sceneOrientation = UIApplication.shared.windows.first?.windowScene?.interfaceOrientation 18 | { 19 | interfaceOrientation = sceneOrientation 20 | } 21 | 22 | let tapPoint = location(in: view) 23 | 24 | switch interfaceOrientation { 25 | case .portrait: 26 | return CGPoint( 27 | x: tapPoint.y / view.bounds.size.height, 28 | y: 1.0 - (tapPoint.x / view.bounds.size.width) 29 | ) 30 | case .portraitUpsideDown: 31 | return CGPoint( 32 | x: 1.0 - (tapPoint.y / view.bounds.size.height), 33 | y: tapPoint.x / view.bounds.size.width 34 | ) 35 | case .landscapeRight: 36 | return CGPoint( 37 | x: tapPoint.x / view.bounds.size.width, 38 | y: tapPoint.y / view.bounds.size.height 39 | ) 40 | case .landscapeLeft: 41 | return CGPoint( 42 | x: 1.0 - (tapPoint.x / view.bounds.size.width), 43 | y: 1.0 - (tapPoint.y / view.bounds.size.height) 44 | ) 45 | default: return nil 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/MediaPicker/MediaPickerViewCell.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import UIKit 5 | 6 | /// Collection view sell that is used to represent a media picker view asset 7 | class MediaPickerViewAssetCell: UICollectionViewCell { 8 | let imageView = UIImageView() 9 | let loadingIndiciator = UIActivityIndicatorView() 10 | let durationLabel = UILabel() 11 | let selectionMask = UIView() 12 | 13 | override init(frame: CGRect) { 14 | super.init(frame: frame) 15 | contentView.addSubview(imageView) 16 | imageView.translatesAutoresizingMaskIntoConstraints = false 17 | contentView.addConstraints([ 18 | imageView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 0), 19 | contentView.trailingAnchor.constraint(equalTo: imageView.trailingAnchor, constant: 0), 20 | imageView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 0), 21 | contentView.bottomAnchor.constraint(equalTo: imageView.bottomAnchor, constant: 0), 22 | ]) 23 | imageView.contentMode = .scaleAspectFill 24 | imageView.layer.cornerRadius = 5 25 | imageView.layer.masksToBounds = true 26 | imageView.layer.cornerCurve = .continuous 27 | durationLabel.textColor = .white 28 | durationLabel.font = UIFont.boldSystemFont(ofSize: 10) 29 | contentView.addSubview(durationLabel) 30 | durationLabel.translatesAutoresizingMaskIntoConstraints = false 31 | contentView.addConstraints([ 32 | durationLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 3), 33 | durationLabel.trailingAnchor.constraint(lessThanOrEqualTo: contentView.trailingAnchor, constant: 3), 34 | contentView.bottomAnchor.constraint(equalTo: durationLabel.bottomAnchor, constant: 3), 35 | ]) 36 | selectionMask.backgroundColor = .clear 37 | selectionMask.layer.borderWidth = 3 38 | selectionMask.layer.borderColor = UIColor.purple.cgColor 39 | selectionMask.layer.cornerRadius = imageView.layer.cornerRadius 40 | selectionMask.layer.cornerCurve = imageView.layer.cornerCurve 41 | selectionMask.isHidden = true 42 | contentView.addSubview(selectionMask) 43 | selectionMask.translatesAutoresizingMaskIntoConstraints = false 44 | contentView.addConstraints([ 45 | imageView.leadingAnchor.constraint(equalTo: selectionMask.leadingAnchor), 46 | imageView.trailingAnchor.constraint(equalTo: selectionMask.trailingAnchor), 47 | imageView.bottomAnchor.constraint(equalTo: selectionMask.bottomAnchor), 48 | imageView.topAnchor.constraint(equalTo: selectionMask.topAnchor), 49 | ]) 50 | contentView.addSubview(loadingIndiciator) 51 | loadingIndiciator.translatesAutoresizingMaskIntoConstraints = false 52 | contentView.addConstraints([ 53 | contentView.centerXAnchor.constraint(equalTo: loadingIndiciator.centerXAnchor), 54 | contentView.centerYAnchor.constraint(equalTo: loadingIndiciator.centerYAnchor), 55 | ]) 56 | } 57 | 58 | @available(*, unavailable) 59 | required init?(coder: NSCoder) { 60 | fatalError("init(coder:) has not been implemented") 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/MediaPicker/MediaPickerViewLoadingFooter.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import UIKit 5 | 6 | /// Loading view footer for media picker view 7 | class MediaPickerViewLoadingFooter: UICollectionReusableView { 8 | let loadingIndicator = UIActivityIndicatorView(style: .gray) 9 | 10 | override init(frame: CGRect) { 11 | super.init(frame: frame) 12 | addSubview(loadingIndicator) 13 | loadingIndicator.translatesAutoresizingMaskIntoConstraints = false 14 | addConstraints([ 15 | centerXAnchor.constraint(equalTo: loadingIndicator.centerXAnchor), 16 | centerYAnchor.constraint(equalTo: loadingIndicator.centerYAnchor), 17 | ]) 18 | loadingIndicator.startAnimating() 19 | } 20 | 21 | @available(*, unavailable) 22 | required init?(coder: NSCoder) { 23 | fatalError("init(coder:) has not been implemented") 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Preview/ImagePreviewViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import Photos 5 | import UIKit 6 | 7 | /// Preview view controller for showing captured photos and images 8 | public class ImagePreviewViewController: PreviewViewController { 9 | // MARK: Properties 10 | 11 | /// UIImage to display 12 | public let image: UIImage 13 | 14 | fileprivate lazy var imageView: UIImageView = { 15 | let view = UIImageView(image: image) 16 | view.accessibilityIdentifier = PreviewElements.imageView.id 17 | view.contentMode = .scaleAspectFill 18 | view.translatesAutoresizingMaskIntoConstraints = false 19 | 20 | return view 21 | }() 22 | 23 | // MARK: Init 24 | 25 | /// Designated init to pass in required deps 26 | /// - Parameter image: UIImage to display 27 | public init(image: UIImage) { 28 | self.image = image 29 | super.init(nibName: nil, bundle: nil) 30 | } 31 | 32 | @available(*, unavailable) 33 | required init?(coder: NSCoder) { 34 | fatalError("init(coder:) has not been implemented") 35 | } 36 | 37 | override public func viewDidLoad() { 38 | super.viewDidLoad() 39 | setup() 40 | } 41 | 42 | // MARK: Setup 43 | 44 | private func setup() { 45 | view.insertSubview(imageView, at: 0) 46 | NSLayoutConstraint.activate([ 47 | imageView.topAnchor.constraint(equalTo: view.topAnchor), 48 | imageView.leadingAnchor.constraint(equalTo: view.leadingAnchor), 49 | imageView.trailingAnchor.constraint(equalTo: view.trailingAnchor), 50 | imageView.bottomAnchor.constraint(equalTo: view.bottomAnchor), 51 | ]) 52 | } 53 | 54 | // MARK: Action Overrides 55 | 56 | override public func openSnapchatPressed(_ sender: UIButton) { 57 | snapchatDelegate?.cameraKitViewController(self, openSnapchat: .photo(image)) 58 | } 59 | 60 | override public func sharePreviewPressed(_ sender: UIButton) { 61 | let viewController = UIActivityViewController(activityItems: [image], applicationActivities: nil) 62 | viewController.popoverPresentationController?.sourceView = sender 63 | present(viewController, animated: true, completion: nil) 64 | } 65 | 66 | override public func savePreviewPressed(_ sender: UIButton) { 67 | PHPhotoLibrary.shared().performChanges({ 68 | PHAssetChangeRequest.creationRequestForAsset(from: self.image) 69 | }) { saved, error in 70 | var title: String 71 | var message: String 72 | if saved { 73 | title = "Save Success" 74 | message = "Successfully saved photo to library" 75 | } else { 76 | title = "Save Failure" 77 | message = "Failed to save photo to library" 78 | print("failed to save video with error: \(error?.localizedDescription ?? "no error")") 79 | } 80 | 81 | DispatchQueue.main.async { 82 | let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert) 83 | let action = UIAlertAction(title: "OK", style: .default, handler: nil) 84 | alertController.addAction(action) 85 | self.present(alertController, animated: true, completion: nil) 86 | } 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "author": "xcode", 4 | "version": 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_adjustment_settings.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "filename": "ring_flash_settings@2x.png", 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "filename": "ring_flash_settings@3x.png", 14 | "idiom": "universal", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "author": "xcode", 20 | "version": 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_adjustment_settings.imageset/ring_flash_settings@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_adjustment_settings.imageset/ring_flash_settings@2x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_adjustment_settings.imageset/ring_flash_settings@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_adjustment_settings.imageset/ring_flash_settings@3x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_camera_flip.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "filename": "Icon@2x.png", 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "filename": "Icon@3x.png", 14 | "idiom": "universal", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "author": "xcode", 20 | "version": 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_camera_flip.imageset/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_camera_flip.imageset/Icon@2x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_camera_flip.imageset/Icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_camera_flip.imageset/Icon@3x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_circle.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "filename": "close_circle@2x.png", 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "filename": "close_circle@3x.png", 14 | "idiom": "universal", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "author": "xcode", 20 | "version": 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_circle.imageset/close_circle@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_circle.imageset/close_circle@2x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_circle.imageset/close_circle@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_circle.imageset/close_circle@3x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_x.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "idiom": "universal", 9 | "filename": "close_x@2x.png", 10 | "scale": "2x" 11 | }, 12 | { 13 | "idiom": "universal", 14 | "filename": "close_x@3x.png", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "version": 1, 20 | "author": "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_x.imageset/close_x@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_x.imageset/close_x@2x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_x.imageset/close_x@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_close_x.imageset/close_x@3x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_flash_off.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "filename": "flash_off@2x.png", 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "filename": "flash_off@3x.png", 14 | "idiom": "universal", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "author": "xcode", 20 | "version": 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_flash_off.imageset/flash_off@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_flash_off.imageset/flash_off@2x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_flash_off.imageset/flash_off@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_flash_off.imageset/flash_off@3x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_flash_on.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "filename": "flash@2x.png", 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "filename": "flash@3x.png", 14 | "idiom": "universal", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "author": "xcode", 20 | "version": 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_flash_on.imageset/flash@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_flash_on.imageset/flash@2x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_flash_on.imageset/flash@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_flash_on.imageset/flash@3x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_empty.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "idiom": "universal", 9 | "filename": "lens_empty@2x.png", 10 | "scale": "2x" 11 | }, 12 | { 13 | "idiom": "universal", 14 | "filename": "lens_empty@3x.png", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "version": 1, 20 | "author": "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_empty.imageset/lens_empty@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_empty.imageset/lens_empty@2x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_empty.imageset/lens_empty@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_empty.imageset/lens_empty@3x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_placeholder.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "idiom": "universal", 9 | "filename": "lens_placeholder@2x.png", 10 | "scale": "2x" 11 | }, 12 | { 13 | "idiom": "universal", 14 | "filename": "lens_placeholder@3x.png", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "version": 1, 20 | "author": "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_placeholder.imageset/lens_placeholder@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_placeholder.imageset/lens_placeholder@2x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_placeholder.imageset/lens_placeholder@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_lens_placeholder.imageset/lens_placeholder@3x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_portrait.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "filename": "icon@2x.png", 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "filename": "icon@3x.png", 14 | "idiom": "universal", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "author": "xcode", 20 | "version": 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_portrait.imageset/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_portrait.imageset/icon@2x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_portrait.imageset/icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_portrait.imageset/icon@3x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_save.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "idiom": "universal", 9 | "filename": "save@2x.png", 10 | "scale": "2x" 11 | }, 12 | { 13 | "idiom": "universal", 14 | "filename": "save@3x.png", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "version": 1, 20 | "author": "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_save.imageset/save@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_save.imageset/save@2x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_save.imageset/save@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_save.imageset/save@3x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_share.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "filename": "share@2x.png", 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "filename": "share@3x.png", 14 | "idiom": "universal", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "author": "xcode", 20 | "version": 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_share.imageset/share@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_share.imageset/share@2x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_share.imageset/share@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_share.imageset/share@3x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_slider_thumb.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "filename": "Selector@2x.png", 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "filename": "Selector@3x.png", 14 | "idiom": "universal", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "author": "xcode", 20 | "version": 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_slider_thumb.imageset/Selector@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_slider_thumb.imageset/Selector@2x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_slider_thumb.imageset/Selector@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_slider_thumb.imageset/Selector@3x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_snap_ghost.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "idiom": "universal", 9 | "filename": "snap_ghost@2x.png", 10 | "scale": "2x" 11 | }, 12 | { 13 | "idiom": "universal", 14 | "filename": "snap_ghost@3x.png", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "version": 1, 20 | "author": "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_snap_ghost.imageset/snap_ghost@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_snap_ghost.imageset/snap_ghost@2x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_snap_ghost.imageset/snap_ghost@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_snap_ghost.imageset/snap_ghost@3x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_snap_ghost_outline.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "filename": "Strokesnapghost.svg", 5 | "idiom": "universal", 6 | "scale": "1x" 7 | }, 8 | { 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "idiom": "universal", 14 | "scale": "3x" 15 | } 16 | ], 17 | "info": { 18 | "author": "xcode", 19 | "version": 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_snapchat_app_icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "idiom": "universal", 9 | "filename": "snapchat_app_icon@2x.png", 10 | "scale": "2x" 11 | }, 12 | { 13 | "idiom": "universal", 14 | "filename": "snapchat_app_icon@3x.png", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "version": 1, 20 | "author": "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_snapchat_app_icon.imageset/snapchat_app_icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_snapchat_app_icon.imageset/snapchat_app_icon@2x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_snapchat_app_icon.imageset/snapchat_app_icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_snapchat_app_icon.imageset/snapchat_app_icon@3x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_tone_mode_off.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "filename": "Tone_Mode_off@2x.png", 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "filename": "Tone_Mode_off@3x.png", 14 | "idiom": "universal", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "author": "xcode", 20 | "version": 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_tone_mode_off.imageset/Tone_Mode_off@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_tone_mode_off.imageset/Tone_Mode_off@2x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_tone_mode_off.imageset/Tone_Mode_off@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_tone_mode_off.imageset/Tone_Mode_off@3x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_tone_mode_on.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "scale": "1x" 6 | }, 7 | { 8 | "filename": "Subtract@2x.png", 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "filename": "Subtract@3x.png", 14 | "idiom": "universal", 15 | "scale": "3x" 16 | } 17 | ], 18 | "info": { 19 | "author": "xcode", 20 | "version": 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_tone_mode_on.imageset/Subtract@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_tone_mode_on.imageset/Subtract@2x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_tone_mode_on.imageset/Subtract@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Snapchat/camera-kit-ios-sdk/cfb5076c981535a47e760079e96755954b7acf4b/Sources/SCSDKCameraKitReferenceUI/Resources/Reference.xcassets/ck_tone_mode_on.imageset/Subtract@3x.png -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/ar.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "بدعم من"; 6 | "camera_kit_powered_by_snapchat" = "بدعم من سناب شات"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/bn-BD.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "দ্বারা চালিত"; 6 | "camera_kit_powered_by_snapchat" = "Snapchat দ্বারা চালিত"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/bn-IN.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "দ্বারা চালিত"; 6 | "camera_kit_powered_by_snapchat" = "Snapchat দ্বারা চালিত"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/da.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Drives af"; 6 | "camera_kit_powered_by_snapchat" = "Drives af Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/de.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Präsentiert von"; 6 | "camera_kit_powered_by_snapchat" = "Präsentiert von Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/el.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Powered by"; 6 | "camera_kit_powered_by_snapchat" = "Powered by Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/en-GB.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Powered by"; 6 | "camera_kit_powered_by_snapchat" = "Powered by Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | /// MARK: Adjustments 6 | "camera_kit_adjustment_active" = "Active"; 7 | "camera_kit_adjustment_intensity_slider" = "Adjustment Intensity Slider"; 8 | "camera_kit_adjustment_portrait" = "Portrait"; 9 | "camera_kit_adjustment_tone" = "Tone"; 10 | 11 | /// MARK: Camera Actions 12 | "camera_kit_camera_flip_button" = "Camera Flip Button"; 13 | "camera_kit_flash_configuration_button" = "Flash Configuration Button"; 14 | "camera_kit_flash_toggle_button" = "Flash Toggle Button"; 15 | "camera_kit_portrait_adjustment_toggle_button" = "Portrait Adjustment Toggle Button"; 16 | "camera_kit_portrait_adjustment_configuration_button" = "Portrait Adjustment Configuration Button"; 17 | "camera_kit_tone_map_adjustment_toggle_button" = "Tone Map Adjustment Toggle Button"; 18 | "camera_kit_tone_map_configuration_button" = "Tone Map Adjustment Configuration Button"; 19 | 20 | /// MARK: Camera View 21 | "camera_kit_flash_control" = "Flash Control"; 22 | "camera_kit_portrait_control" = "Portrait Control"; 23 | "camera_kit_tone_map_control" = "Tone Map Control"; 24 | 25 | /// MARK: Connected Lenses 26 | "camera_kit_connected_lenses_cancel" = "Cancel"; 27 | "camera_kit_connected_lenses_group_id" = "Group ID"; 28 | "camera_kit_connected_lenses_join_failed_message" = "Failed to join connected lenses session, please try again later."; 29 | "camera_kit_connected_lenses_join_failed_title" = "Error"; 30 | "camera_kit_connected_lenses_join_session_message" = "Join a session with a group ID."; 31 | "camera_kit_connected_lenses_join_session_title" = "Connected Lenses"; 32 | "camera_kit_connected_lenses_join" = "Join"; 33 | "camera_kit_connected_lenses_ok" = "Ok"; 34 | "camera_kit_connected_lenses_start" = "Start"; 35 | 36 | /// MARK: Flash 37 | "camera_kit_flash" = "Flash"; 38 | "camera_kit_flash_mode_selector" = "Flash Mode Selector"; 39 | "camera_kit_ring" = "Ring"; 40 | "camera_kit_ring_light_color_selector" = "Ring Light Color Selector"; 41 | "camera_kit_ring_light_intensity_slider" = "Ring Light Intensity Slider"; 42 | "camera_kit_standard" = "Standard"; 43 | 44 | /// MARK: Helper 45 | "camera_kit_tap_to_dismiss" = "Tap anywhere to dismiss"; 46 | 47 | /// MARK: Views 48 | "camera_kit_no_media_found" = "No Media Found"; 49 | "camera_kit_powered_by" = "Powered by"; 50 | "camera_kit_powered_by_snapchat" = "Powered by Snapchat"; 51 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/es-AR.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Con tecnología de"; 6 | "camera_kit_powered_by_snapchat" = "Provisto por Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/es-ES.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Con tecnología de"; 6 | "camera_kit_powered_by_snapchat" = "Con tecnología de Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/es-MX.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Con tecnología de"; 6 | "camera_kit_powered_by_snapchat" = "Con tecnología de Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/es.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Con tecnología de"; 6 | "camera_kit_powered_by_snapchat" = "Con la tecnología de Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/fi.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Powered by"; 6 | "camera_kit_powered_by_snapchat" = "Powered by Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/fil-PH.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Powered by"; 6 | "camera_kit_powered_by_snapchat" = "Powered by Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/fr.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Par"; 6 | "camera_kit_powered_by_snapchat" = "Par Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/gu-IN.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "સંચાલનકર્તા"; 6 | "camera_kit_powered_by_snapchat" = "Snapchat દ્વારા સંચાલિત"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/hi-IN.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "पावर्ड बाय"; 6 | "camera_kit_powered_by_snapchat" = "पावर्ड बाय Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/id.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Didukung oleh"; 6 | "camera_kit_powered_by_snapchat" = "Didukung oleh Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/it.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Powered by"; 6 | "camera_kit_powered_by_snapchat" = "Powered by Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/ja.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "提供:"; 6 | "camera_kit_powered_by_snapchat" = "提供:Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/kn-IN.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "ಇದರಿಂದ ಸಂಚಾಲಿತ"; 6 | "camera_kit_powered_by_snapchat" = "Snapchat ನಿಂದ ಸಂಚಾಲಿತ"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/ko.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "제공"; 6 | "camera_kit_powered_by_snapchat" = "Snapchat 제공"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/ml-IN.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "നൽകുന്നത്"; 6 | "camera_kit_powered_by_snapchat" = "Snapchat നൽകുന്നത്"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/mr-IN.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "द्वारे समर्थित"; 6 | "camera_kit_powered_by_snapchat" = "Snapchat द्वारे समर्थित"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/ms-MY.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Dikuasakan oleh"; 6 | "camera_kit_powered_by_snapchat" = "Dikuasakan oleh Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/nb.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Drevet av"; 6 | "camera_kit_powered_by_snapchat" = "Drevet av Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/nl.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Mogelijk gemaakt door"; 6 | "camera_kit_powered_by_snapchat" = "Mogelijk gemaakt door Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/pa-IN.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "ਸੰਚਾਲਨ ਕਰਤਾ"; 6 | "camera_kit_powered_by_snapchat" = "Snapchat ਦੁਆਰਾ ਸੰਚਾਲਿਤ"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/pl.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Obsługiwane przez"; 6 | "camera_kit_powered_by_snapchat" = "Obsługiwane przez Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/pt-PT.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Desenvolvido por"; 6 | "camera_kit_powered_by_snapchat" = "Desenvolvido por Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/pt.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Desenvolvido por"; 6 | "camera_kit_powered_by_snapchat" = "Desenvolvido pelo Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/ro.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Susținut de"; 6 | "camera_kit_powered_by_snapchat" = "Realizat de Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/ru.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "На платформе"; 6 | "camera_kit_powered_by_snapchat" = "На платформе Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/sv.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Drivs av"; 6 | "camera_kit_powered_by_snapchat" = "Drivs av Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/ta-IN.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "வழங்குபவர்"; 6 | "camera_kit_powered_by_snapchat" = "Snapchat வழங்குகிறது"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/te-IN.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "దీని ద్వారా ఆధారితం"; 6 | "camera_kit_powered_by_snapchat" = "Snapchat ద్వారా ఆధారితం"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/th-TH.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "ดำเนินการโดย"; 6 | "camera_kit_powered_by_snapchat" = "ดำเนินการโดย Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/tr.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Destekleyen:"; 6 | "camera_kit_powered_by_snapchat" = "Snapchat tarafından desteklenmektedir"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/ur-PK.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "تقویت یافتہ منجانب"; 6 | "camera_kit_powered_by_snapchat" = "Snapchat کی جانب سے تقویت یافتہ"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/vi-VN.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "Được cung cấp bởi"; 6 | "camera_kit_powered_by_snapchat" = "Được cung cấp bởi Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/zh-Hans.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "技术支持:"; 6 | "camera_kit_powered_by_snapchat" = "由 Snapchat 提供支持"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Resources/Strings/zh-Hant.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | "camera_kit_powered_by" = "技術支援:"; 6 | "camera_kit_powered_by_snapchat" = "技術支援:Snapchat"; 7 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Snapchat/Snapchat.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import SCSDKCameraKit 5 | import UIKit 6 | 7 | /// Describes the Snapchat screen to open to 8 | public enum SnapchatScreen { 9 | case profile 10 | case lens(Lens) 11 | case photo(UIImage) 12 | case video(URL) 13 | } 14 | 15 | /// CameraKit view controllers will notify this delegate when it needs to open, send info, or interact with Snapchat 16 | public protocol SnapchatDelegate: AnyObject { 17 | /// CameraKit view controller requests opening Snapchat with specific info 18 | /// - Parameters: 19 | /// - viewController: CameraKit view controller instance 20 | /// - screen: Snapchat screen to open to 21 | func cameraKitViewController(_ viewController: UIViewController, openSnapchat screen: SnapchatScreen) 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Support/Testable.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | 3 | import Foundation 4 | 5 | /// Describes an element that can be UI tested 6 | public protocol TestableElement { 7 | /// identifier for the testable element 8 | var id: String { get } 9 | } 10 | 11 | extension TestableElement where Self: RawRepresentable { 12 | public var id: String { 13 | "\(String(describing: type(of: self)))_\(rawValue)" 14 | } 15 | } 16 | 17 | // MARK: Camera Bottom Bar 18 | 19 | /// CameraBottomBar view testable elements 20 | public enum CameraBottomBarElements: String, TestableElement { 21 | case closeButton 22 | } 23 | 24 | // MARK: Camera View 25 | 26 | /// CameraViewController testable elements 27 | public enum CameraElements: String, TestableElement { 28 | case lensLabel 29 | case flipCameraButton 30 | case flashToggleButton 31 | case flashConfigurationButton 32 | case flashControl 33 | case flashControlDismissalHint 34 | case toneMapToggleButton 35 | case toneMapConfigurationButton 36 | case toneMapControl 37 | case toneMapControlDismissalHint 38 | case portraitToggleButton 39 | case portraitConfigurationButton 40 | case portraitControl 41 | case portraitControlDismissalHint 42 | case ringLightView 43 | case photoLibraryButton 44 | case cameraButton 45 | } 46 | 47 | extension CameraElements { 48 | public enum CameraFlip { 49 | public static let front = "front" 50 | public static let back = "back" 51 | } 52 | } 53 | 54 | // MARK: Carousel 55 | 56 | /// CarouselView testable elements 57 | public enum CarouselElements: String, TestableElement { 58 | case collectionView 59 | case lensCell 60 | case facadeSelectionRingView 61 | } 62 | 63 | // MARK: Preview 64 | 65 | /// PreviewViewController testable elements 66 | public enum PreviewElements: String, TestableElement { 67 | case closeButton 68 | case snapchatButton 69 | case shareButton 70 | case imageView 71 | case playerControllerView 72 | } 73 | 74 | // MARK: Message Notification 75 | 76 | /// MessageNotificationView testable elements 77 | public enum MessageNotificationElements: String, TestableElement { 78 | case label 79 | } 80 | 81 | // MARK: Flash Control 82 | 83 | /// FlashControlView testable elements 84 | public enum FlashControlElements: String, TestableElement { 85 | case flashModeSelector 86 | case ringLightColorSelector 87 | case ringLightIntensitySlider 88 | } 89 | 90 | // MARK: Other Elements 91 | 92 | /// Other misc testable elements 93 | public enum OtherElements: String, TestableElement { 94 | case noOpButton 95 | case arkitButton 96 | case agreementsButton 97 | case tapToFocusView 98 | case pairingButton 99 | case selectSourceButton 100 | case connectedLensStartButton 101 | case mirrorButton 102 | } 103 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/UserData/UserDataProvider.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import Foundation 5 | import SCSDKCameraKit 6 | 7 | /// Default user data provider to show how to provide user data to CameraKit 8 | public class UserDataProvider: NSObject, SCSDKCameraKit.UserDataProvider { 9 | /// Delegate for CameraKit to receive updates on user data 10 | public weak var delegate: UserDataProviderDelegate? 11 | 12 | /// Mocked user data 13 | public lazy var userData: UserData? = UserData( 14 | displayName: "Jane Doe", 15 | birthDate: formatter.date(from: "1974-05-05"), 16 | bitmojiInfo: BitmojiUserInfo(avatarId: "99585497304_1-s5") 17 | ) 18 | 19 | /// Date formatter to formate birth date for user data 20 | private let formatter: DateFormatter = { 21 | let formatter = DateFormatter() 22 | formatter.dateFormat = "yyyy-MM-dd" 23 | return formatter 24 | }() 25 | } 26 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Views/CameraBottomBar.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import UIKit 5 | 6 | /// Bottom bar on Camera that contains Snap ghost button for actions 7 | /// as well as close button to clear current lens 8 | public class CameraBottomBar: UIView { 9 | private enum Constants { 10 | static let snapImage = "ck_snap_ghost" 11 | static let closeCircle = "ck_close_circle" 12 | } 13 | 14 | /// Snap ghost button for lens actions 15 | public let snapButton: UIButton = { 16 | let button = UIButton() 17 | button.isHidden = true 18 | button.setImage( 19 | UIImage(named: Constants.snapImage, in: BundleHelper.resourcesBundle, compatibleWith: nil), for: .normal 20 | ) 21 | button.translatesAutoresizingMaskIntoConstraints = false 22 | 23 | return button 24 | }() 25 | 26 | /// Close button to clear current lens 27 | public let closeButton: UIButton = { 28 | let button = UIButton() 29 | button.accessibilityIdentifier = CameraBottomBarElements.closeButton.id 30 | button.isHidden = true 31 | button.setImage( 32 | UIImage(named: Constants.closeCircle, in: BundleHelper.resourcesBundle, compatibleWith: nil), for: .normal 33 | ) 34 | button.translatesAutoresizingMaskIntoConstraints = false 35 | 36 | return button 37 | }() 38 | 39 | init() { 40 | super.init(frame: .zero) 41 | commonInit() 42 | } 43 | 44 | override init(frame: CGRect) { 45 | super.init(frame: frame) 46 | commonInit() 47 | } 48 | 49 | required init?(coder: NSCoder) { 50 | super.init(coder: coder) 51 | commonInit() 52 | } 53 | 54 | private func commonInit() { 55 | addSubview(snapButton) 56 | addSubview(closeButton) 57 | 58 | setupConstraints() 59 | } 60 | 61 | private func setupConstraints() { 62 | NSLayoutConstraint.activate([ 63 | snapButton.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 30.0), 64 | snapButton.topAnchor.constraint(equalTo: topAnchor), 65 | closeButton.centerXAnchor.constraint(equalTo: centerXAnchor), 66 | closeButton.centerYAnchor.constraint(equalTo: snapButton.centerYAnchor), 67 | ]) 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Views/MessageNotificationView.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import UIKit 5 | 6 | /// Popup message notification view for different lens events 7 | public class MessageNotificationView: UIView { 8 | /// Default label in the message notification view 9 | public let label: UILabel = { 10 | let label = UILabel() 11 | label.accessibilityIdentifier = MessageNotificationElements.label.id 12 | label.font = .preferredFont(forTextStyle: .headline) 13 | label.textColor = .white 14 | label.translatesAutoresizingMaskIntoConstraints = false 15 | label.lineBreakMode = .byWordWrapping 16 | return label 17 | }() 18 | 19 | public init() { 20 | super.init(frame: .zero) 21 | commonInit() 22 | } 23 | 24 | override init(frame: CGRect) { 25 | super.init(frame: frame) 26 | commonInit() 27 | } 28 | 29 | required init?(coder: NSCoder) { 30 | super.init(coder: coder) 31 | commonInit() 32 | } 33 | 34 | private func commonInit() { 35 | backgroundColor = UIColor.black.withAlphaComponent(0.65) 36 | layer.cornerRadius = 4.0 37 | addSubview(label) 38 | setupConstraints() 39 | } 40 | 41 | private func setupConstraints() { 42 | NSLayoutConstraint.activate([ 43 | label.topAnchor.constraint(equalTo: topAnchor, constant: 8.0), 44 | label.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 8.0), 45 | label.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -8.0), 46 | label.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -8.0), 47 | ]) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Sources/SCSDKCameraKitReferenceUI/Views/SnapAttributionView.swift: -------------------------------------------------------------------------------- 1 | // Copyright Snap Inc. All rights reserved. 2 | // CameraKit 3 | 4 | import UIKit 5 | 6 | /// Snap attribution on Camera that contains "Powered by" and Snap ghost icon 7 | public class SnapAttributionView: UIView { 8 | private enum Constants { 9 | static let snapGhostOutline = "ck_snap_ghost_outline" 10 | } 11 | 12 | public let poweredByLabel: UILabel = { 13 | let label = UILabel() 14 | label.translatesAutoresizingMaskIntoConstraints = false 15 | label.textColor = .white 16 | label.font = UIFont.sc_regularFont(size: 12) 17 | label.textAlignment = .center 18 | label.text = CameraKitLocalizedString(key: "camera_kit_powered_by", comment: "") 19 | label.sizeToFit() 20 | label.isAccessibilityElement = false 21 | 22 | return label 23 | }() 24 | 25 | public let snapIconImage: UIImageView = { 26 | let imageView = UIImageView() 27 | imageView.image = UIImage( 28 | named: Constants.snapGhostOutline, 29 | in: BundleHelper.resourcesBundle, 30 | compatibleWith: nil 31 | ) 32 | imageView.translatesAutoresizingMaskIntoConstraints = false 33 | imageView.isAccessibilityElement = false 34 | 35 | return imageView 36 | }() 37 | 38 | init() { 39 | super.init(frame: .zero) 40 | commonInit() 41 | } 42 | 43 | override init(frame: CGRect) { 44 | super.init(frame: frame) 45 | commonInit() 46 | } 47 | 48 | required init?(coder: NSCoder) { 49 | super.init(coder: coder) 50 | commonInit() 51 | } 52 | 53 | private func commonInit() { 54 | isAccessibilityElement = true 55 | accessibilityIdentifier = CameraKitLocalizedString(key: "camera_kit_powered_by_snapchat", comment: "") 56 | 57 | addSubview(poweredByLabel) 58 | addSubview(snapIconImage) 59 | 60 | setupConstraints() 61 | } 62 | 63 | private func setupConstraints() { 64 | NSLayoutConstraint.activate([ 65 | widthAnchor.constraint(equalToConstant: 84), 66 | 67 | poweredByLabel.leadingAnchor.constraint(equalTo: leadingAnchor), 68 | poweredByLabel.centerYAnchor.constraint(equalTo: centerYAnchor), 69 | 70 | snapIconImage.leadingAnchor.constraint(equalTo: poweredByLabel.trailingAnchor, constant: 4), 71 | snapIconImage.centerYAnchor.constraint(equalTo: centerYAnchor), 72 | ]) 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 1.40.0 2 | --------------------------------------------------------------------------------