25 Commits

Author SHA1 Message Date
Ahmed Bekhit 8eabd31931 Merge pull request #105 from GiacomoLeopizzi/swift_package_manager
Swift package manager
2020-02-27 11:26:27 -05:00
Giacomo 6c0465b521 Merge pull request #2 from GiacomoLeopizzi/swift_5
Update
2020-02-26 16:58:54 +01:00
Giacomo d77170b2ba Merge pull request #1 from AFathi/swift_5
Update
2020-02-26 16:56:11 +01:00
Giacomo 419c434503 Readme updated 2020-02-26 16:42:59 +01:00
Giacomo d952f66094 Remove not needed files 2020-02-26 16:34:41 +01:00
Giacomo c6b94a485a SwiftPM 2020-02-26 16:26:20 +01:00
Ahmed Bekhit 24d9220fad Merge pull request #104 from GiacomoLeopizzi/weak_delegate
Added weak
2020-02-20 15:39:03 -08:00
Giacomo 62ed6bc6b7 Added weak 2020-02-20 23:40:53 +01:00
Giacomo 187c505359 Merge branch 'view_aspect_ratio' into swift_package_manager 2020-02-13 12:11:48 +02:00
Giacomo 2c1a98a12a Dynamic library 2020-02-13 12:09:05 +02:00
Giacomo 2eef6c5b44 Swift package manager 2020-02-13 11:50:54 +02:00
Ahmed Bekhit cabc5535f0 Merge pull request #100 from GiacomoLeopizzi/view_aspect_ratio
Support for custom aspect ratio
2020-02-09 10:44:13 -08:00
Giacomo e9a88d4a2b Support for custom aspect ratio 2020-02-09 14:21:27 +01:00
Ahmed Bekhit 7cc44e3eae Update README.md 2020-01-10 13:39:31 -05:00
Ahmed Bekhit dcddd6b7c3 Update + validate podspec file 2020-01-10 13:01:26 -05:00
Ahmed Bekhit 8e6f8bd448 Update podspec file 2020-01-10 12:40:55 -05:00
Ahmed Bekhit a56f372be8 Update podspec file 2020-01-10 12:36:22 -05:00
Ahmed Bekhit e01e55fa65 Merge pull request #98 from bartosy-ymija/swift_5
Add SCNTechnique retaining support
2019-11-21 13:28:24 -05:00
Bartosy 3b74f31e22 Ensure nil safety 2019-11-20 20:04:30 +01:00
Bartosy 5d19bc6959 Add technique retaining support 2019-11-20 13:51:01 +01:00
Ahmed Bekhit b87b020996 Merge pull request #95 from maxxfrazer/swift_5
Rebasing with Xcode 11 fixes
2019-09-08 14:33:28 -04:00
Ahmed Bekhit 7acb7a2dfd Update example project Swift version 2019-09-08 15:58:04 +01:00
Saul Moreno Abril 84c501810f Update to Swift 5.0 2019-09-08 15:58:04 +01:00
Ahmed Bekhit 95994f707f Update example project Swift version 2019-06-25 22:24:27 -04:00
Saul Moreno Abril 54ad883307 Update to Swift 5.0 2019-03-30 12:27:11 +01:00
12 changed files with 71 additions and 44 deletions
+1
View File
@@ -65,3 +65,4 @@ fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
.DS_Store
+4 -4
View File
@@ -1,11 +1,11 @@
Pod::Spec.new do |s|
s.name = "ARVideoKit"
s.version = "1.51"
s.version = "1.5.51"
s.summary = "Capture & record ARKit videos 📹, photos 🌄, Live Photos 🎇, and GIFs 🎆."
s.description = "Enabling developers to capture videos 📹, photos 🌄, Live Photos 🎇, and GIFs 🎆 with augmented reality components."
s.homepage = "https://github.com/AFathi/ARVideoKit"
s.screenshots = "http://www.ahmedbekhit.com/SK_PREV.gif", "http://www.ahmedbekhit.com/SCN_PREVIEW.gif"
s.swift_version = '4.2'
s.swift_version = '5.0'
s.license = { :type => "Apache 2.0", :file => "LICENSE" }
@@ -16,8 +16,8 @@ Pod::Spec.new do |s|
s.platform = :ios, "11.0"
# ARVideoKit for Swift 4.2
s.source = { :git => "https://github.com/AFathi/ARVideoKit.git", :tag => "1.51" }
# ARVideoKit for Swift 5.0
s.source = { :git => "https://github.com/AFathi/ARVideoKit.git", :tag => "1.5.51" }
s.source_files = "ARVideoKit", "ARVideoKit/**/*.{h,m,swift}"
s.resources = "ARVideoKit/Assets/*.scnassets"
end
+4 -15
View File
@@ -11,7 +11,6 @@
FB2E36891FAE29C00035B8D6 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = FB2E36881FAE29BF0035B8D6 /* LICENSE */; };
FB404FFE20D72A190056EA1D /* JPEG.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB404FFD20D72A190056EA1D /* JPEG.swift */; };
FBD604DF1FA969DD00EC9804 /* ARVideoKit.h in Headers */ = {isa = PBXBuildFile; fileRef = FBD604DD1FA969DD00EC9804 /* ARVideoKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
FBD604EB1FA96B1C00EC9804 /* video.scnassets in Resources */ = {isa = PBXBuildFile; fileRef = FBD604EA1FA96B1C00EC9804 /* video.scnassets */; };
FBD604EE1FA96B2700EC9804 /* ARVideoOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBD604EC1FA96B2700EC9804 /* ARVideoOptions.swift */; };
FBD604EF1FA96B2700EC9804 /* ARInputViewOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBD604ED1FA96B2700EC9804 /* ARInputViewOptions.swift */; };
FBD604F51FA96B3300EC9804 /* UIImage+VideoBuffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBD604F01FA96B3300EC9804 /* UIImage+VideoBuffer.swift */; };
@@ -40,7 +39,6 @@
FBD604DA1FA969DD00EC9804 /* ARVideoKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ARVideoKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
FBD604DD1FA969DD00EC9804 /* ARVideoKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ARVideoKit.h; sourceTree = "<group>"; };
FBD604DE1FA969DD00EC9804 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
FBD604EA1FA96B1C00EC9804 /* video.scnassets */ = {isa = PBXFileReference; lastKnownFileType = wrapper.scnassets; path = video.scnassets; sourceTree = "<group>"; };
FBD604EC1FA96B2700EC9804 /* ARVideoOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ARVideoOptions.swift; sourceTree = "<group>"; };
FBD604ED1FA96B2700EC9804 /* ARInputViewOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ARInputViewOptions.swift; sourceTree = "<group>"; };
FBD604F01FA96B3300EC9804 /* UIImage+VideoBuffer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage+VideoBuffer.swift"; sourceTree = "<group>"; };
@@ -110,7 +108,6 @@
isa = PBXGroup;
children = (
B466A8B62279E33800BD7070 /* Utils */,
FBD604E51FA96ACD00EC9804 /* Assets */,
FBD604E61FA96AD400EC9804 /* Enumerations */,
FBD604E71FA96AE500EC9804 /* Extensions */,
FBD604E81FA96AEC00EC9804 /* Protocols */,
@@ -122,14 +119,6 @@
path = ARVideoKit;
sourceTree = "<group>";
};
FBD604E51FA96ACD00EC9804 /* Assets */ = {
isa = PBXGroup;
children = (
FBD604EA1FA96B1C00EC9804 /* video.scnassets */,
);
path = Assets;
sourceTree = "<group>";
};
FBD604E61FA96AD400EC9804 /* Enumerations */ = {
isa = PBXGroup;
children = (
@@ -252,7 +241,7 @@
TargetAttributes = {
FBD604D91FA969DD00EC9804 = {
CreatedOnToolsVersion = 9.1;
LastSwiftMigration = 0910;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
};
@@ -263,6 +252,7 @@
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = FBD604D01FA969DD00EC9804;
productRefGroup = FBD604DB1FA969DD00EC9804 /* Products */;
@@ -280,7 +270,6 @@
buildActionMask = 2147483647;
files = (
FB2E36891FAE29C00035B8D6 /* LICENSE in Resources */,
FBD604EB1FA96B1C00EC9804 /* video.scnassets in Resources */,
FBD605071FA96B6B00EC9804 /* LoveLiver_LICENSE in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -462,7 +451,7 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -487,7 +476,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.ahmedbekhit.ARVideoKit;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Binary file not shown.
@@ -5,6 +5,7 @@
// Created by Ahmed Bekhit on 10/18/17.
// Copyright © 2017 Ahmed Fathi Bekhit. All rights reserved.
//
import Foundation
/// Allows specifying the final video orientation.
@objc public enum ARFrameMode: Int {
@@ -12,6 +13,7 @@
case aspectFit
/// Recommended for iPhone X
case aspectFill
case viewAspectRatio
}
/// Allows specifying the video rendering frame per second `FPS` rate.
@@ -8,6 +8,7 @@
import AVFoundation
import Photos
import UIKit
@available(iOS 11.0, *)
extension RecordAR {
@@ -8,6 +8,7 @@
import AVFoundation
import Photos
import UIKit
@available(iOS 11.0, *)
class LivePhotoGenerator {
+7
View File
@@ -54,6 +54,13 @@ struct RenderAR {
case .aspectFill:
width = Int(UIScreen.main.nativeBounds.width)
height = Int(UIScreen.main.nativeBounds.height)
case .viewAspectRatio where view is UIView:
let bufferWidth = CVPixelBufferGetWidth(raw)
let bufferHeight = CVPixelBufferGetHeight(raw)
let viewSize = (view as! UIView).bounds.size
let targetSize = AVMakeRect(aspectRatio: viewSize, insideRect: CGRect(x: 0, y: 0, width: bufferWidth, height: bufferHeight)).size
width = Int(targetSize.width)
height = Int(targetSize.height)
default:
if UIScreen.main.isiPhone10 {
width = Int(UIScreen.main.nativeBounds.width)
+22 -14
View File
@@ -27,11 +27,11 @@ import PhotosUI
/**
An object that passes the AR recorder errors and status in the protocol methods.
*/
@objc public var delegate: RecordARDelegate?
@objc weak public var delegate: RecordARDelegate?
/**
An object that passes the AR rendered content in the protocol method.
*/
@objc public var renderAR: RenderARDelegate?
@objc weak public var renderAR: RenderARDelegate?
/**
An object that returns the AR recorder current status.
*/
@@ -109,6 +109,21 @@ import PhotosUI
}
}
}
/**
A boolean that indicates whether render engine should retain SCNTechnique used in the view. Default is `false`.
*/
@objc public var retainTechnique: Bool = false {
didSet {
if retainTechnique {
guard let techniqueSupportingView = view as? SCNTechniqueSupport else {
return
}
renderEngine?.technique = techniqueSupportingView.technique
} else {
renderEngine?.technique = nil
}
}
}
//MARK: - Public initialization methods
/**
@@ -128,16 +143,9 @@ import PhotosUI
view = ARSpriteKit
scnView = SCNView(frame: UIScreen.main.bounds)
let bundle = Bundle(for: RecordAR.self)
let url = bundle.url(forResource: "video.scnassets/vid", withExtension: "scn")
do {
let scene = try SCNScene(url: url!, options: nil)
scnView.scene = scene
setup()
}catch let error {
logAR.message("Error occurred while loading SK Video Assets : \(error). Please download \"video.scnassets\" from\nwww.ahmedbekhit.com/ARVideoKitAssets")
}
let scene = SCNScene()
scnView.scene = scene
setup()
}
/**
@@ -716,7 +724,7 @@ import PhotosUI
Recommended to use in the `UIViewController`'s method `func viewWillAppear(_ animated: Bool)`
- parameter configuration: An object that defines motion and scene tracking behaviors for the session.
*/
@objc public func prepare(_ configuration: ARConfiguration? = nil) {
@objc func prepare(_ configuration: ARConfiguration? = nil) {
ARcontentMode = contentMode
onlyRenderWhileRec = onlyRenderWhileRecording
if let view = view as? ARSCNView {
@@ -741,7 +749,7 @@ import PhotosUI
Recommended to use in the `UIViewController`'s method `func viewWillDisappear(_ animated: Bool)`.
*/
@objc public func rest() {
@objc func rest() {
ViewAR.orientation = UIInterfaceOrientationMask(ViewAR.orientations)
}
}
@@ -429,7 +429,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.ahmedbekhit.ARVideoKit-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -451,7 +451,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.ahmedbekhit.ARVideoKit-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
+17 -2
View File
@@ -1,8 +1,23 @@
// swift-tools-version:4.0
// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "ARVideoKit"
name: "ARVideoKit",
platforms: [
.iOS(.v11)
],
products: [
.library(
name: "ARVideoKit",
targets: ["ARVideoKit"]),
],
dependencies: [ ],
targets: [
.target(
name: "ARVideoKit",
dependencies: [],
path: "ARVideoKit")
]
)
+10 -7
View File
@@ -1,4 +1,4 @@
> Use [swift_5](https://github.com/AFathi/ARVideoKit/tree/swift_5) branch for projects written in Swift 5
> Use [swift_4_2](https://github.com/AFathi/ARVideoKit/tree/swift_4_2) branch for projects written in Swift 4.2
> Use [master](https://github.com/AFathi/ARVideoKit/tree/master) branch for projects written in Swift 4.0
@@ -54,9 +54,10 @@ To try the example project, simply clone this repository and open the `Examples`
## Installation
### Cocoapods
1. Add this line to your project's `Podfile`
1. Add this line to your project's `Podfile` (for Swift 5.0)
```
pod 'ARVideoKit'
pod 'ARVideoKit', '~> 1.5.51'
```
2. Install the pod
```
@@ -73,11 +74,13 @@ github "AFathi/ARVideoKit" ~> 1.31
$ carthage update
```
### Manual
Drag the `ARVideoKit.framework` file as an embedded binary of your project targets. `ARVideoKit.framework` can be found in the `/Framework Build/` folder of this repository.
![Tutorial](http://www.ahmedbekhit.com/arvideokit_install_new.gif)
### Swift Package Manager (available Xcode 11.2 and forward)
Or you may drag `ARVideoKit.xcodeproj` into your project and click the **+** button in the embedded binaries section of your project's target.
1. In Xcode, select File > Swift Packages > Add Package Dependency.
2. Follow the prompts using the URL for this repository.
### Manual
Drag `ARVideoKit.xcodeproj` into your project and click the **+** button in the embedded binaries section of your project's target.
![example embed framework](http://www.ahmedbekhit.com/embeddedBinary.png)
## Implementation
### Swift