iCimulator 1.5

iCimulator 1.5

YuWd维护。



  • YuigaWada

License Swift Version CocoaPods Compatible Carthage compatible


iOS Camera Simulator📷

iCimulator允许我们在iOS模拟器上使用相机功能!

2019年10月23日:添加了新的模式“Mac相机模式”!

→点击此处获取详细信息!


支持AVFoundationUIImagePickerController

安装🎈

CocoaPods

您可以使用CocoaPods安装iCimulator,方法是在您的Podfile中添加它

pod 'iCimulator'

Carthage

创建一个包含框架的Cartfile并运行carthage update。按照说明$(SRCROOT)/Carthage/Build/iOS/iCimulator.framework添加到iOS项目中。

github "YuigaWada/iCimulator"

手动

  1. 下载并将 iCimulator 添加到您的项目中。
  2. 恭喜!



用法🍏- 图片或视频 -

只需5步!

  1. 准备演示数据。(图片/视频)
  2. 安装 iCimulator
  3. iCimulator.swiftiCimulator.plist 复制到您的项目。
  4. 设置 iCimulator.plist,其中描述了使用什么样的模拟数据。
  5. iCimulator.swiftiCimulator.plist 链接到您的项目。

您可以从 template 文件夹中复制 iCimulator.swiftiCimulator.plist






**所有使用相机功能的项目都必须完成这5步。**



iCimulator.plist

备注
类型 图片 可以设置图片作为模拟
视频 可以设置视频作为模拟
Mac-Camera 点击这里获取详细信息!
参数 ... 在这里写下您模拟数据的路径



iCimulator.swift

//
//   ** iCimulator.swift **
//


// MIT License
//
// Copyright (c) 2019 YuigaWada
//
// 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:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// 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.
//



#if targetEnvironment(simulator)
    import iCimulator

    //AVFoundation
    public typealias AVCaptureDevice = FakeCaptureDevice
    public typealias AVCaptureSession = FakeCaptureSession
    public typealias AVCaptureVideoPreviewLayer = FakePreviewLayer
    public typealias AVCapturePhotoOutput = FakeCapturePhotoOutput
    public typealias AVCapturePhotoCaptureDelegate = FakeCapturePhotoCaptureDelegate
    public typealias AVCapturePhoto = FakeCapturePhoto
    public typealias AVCaptureDeviceInput = FakeCaptureDeviceInput
    public typealias AVCaptureMovieFileOutput = FakeCaptureMovieFileOutput
    public typealias AVCaptureFileOutput = FakeCaptureFileOutput
    public typealias AVCaptureFileOutputRecordingDelegate = FakeCaptureFileOutputRecordingDelegate
    public typealias AVCaptureConnection = FakeCaptureConnection
    public typealias AVCapturePhotoSettings = FakeCapturePhotoSettings
    public typealias AVCaptureResolvedPhotoSettings = FakeCaptureResolvedPhotoSettings


    //For supporting iOS 10.
    public typealias AVCaptureStillImageOutput = FakeCaptureStillImageOutput
    public typealias CMSampleBuffer = FakeCMSampleBuffer

    //UIImagePickerController
    public typealias UIImagePickerController = FakeImagePickerController
    public typealias UIImagePickerControllerDelegate = FakeImagePickerControllerDelegate
#endif



用法🍎- Mac 相机 -

您可以使用MacBook的相机来模拟相机功能!!

首先,您需要在MacBook上启动一个相机服务器。

打开 streaming_server 并启动 streaming_server/server.py


检查您的 iCimulator.plist 后,您可以在iOS模拟器中看到您的MacBook相机。😊

依赖项

  • Python 3.7.3
  • Numpy
  • opencv-python

选项

您可以使用这些选项来使用 streaming_server/server.py.


___________________________________________________________________________


██╗ ██████╗██╗███╗   ███╗██╗   ██╗██╗      █████╗ ████████╗ ██████╗ ██████╗
██║██╔════╝██║████╗ ████║██║   ██║██║     ██╔══██╗╚══██╔══╝██╔═══██╗██╔══██╗
██║██║     ██║██╔████╔██║██║   ██║██║     ███████║   ██║   ██║   ██║██████╔╝
██║██║     ██║██║╚██╔╝██║██║   ██║██║     ██╔══██║   ██║   ██║   ██║██╔══██╗
██║╚██████╗██║██║ ╚═╝ ██║╚██████╔╝███████╗██║  ██║   ██║   ╚██████╔╝██║  ██║
╚═╝ ╚═════╝╚═╝╚═╝     ╚═╝ ╚═════╝ ╚══════╝╚═╝  ╚═╝   ╚═╝    ╚═════╝ ╚═╝  ╚═╝

                                                            by Yuiga Wada.
___________________________________________________________________________

-v / -verbose / --verbose : turn on Verbose Mode.

-h / -help / --help : show help.

-c / -camera / --camera : enable you to show the captured frame on another window.



示例

CameraKit



Fusuma



待办📒

  • typealias对象的Class →相互可交换
  • 准备Carthage
  • 准备CocoaPods
  • 创建日语版README

贡献

感谢您对 iCimulator 的贡献,有关更多信息,请查看 LICENSE 文件。

其他

Yuiga Wada - 网站 Twitter - @YuigaWada

在 MIT 许可下分发。更多详细信息请参阅 LICENSE

https://github.com/YuigaWada/iCimulator