Skip to content

Commit

Permalink
migrate to swift4
Browse files Browse the repository at this point in the history
  • Loading branch information
guolingege committed Nov 21, 2017
1 parent d9453ff commit 14dc278
Show file tree
Hide file tree
Showing 13 changed files with 115 additions and 48 deletions.
46 changes: 40 additions & 6 deletions LivePhotoDemoSwift.xcodeproj/project.pbxproj 100644 → 100755
Expand Up @@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
283372D41BF538BC00D343E4 /* JPEG.swift in Sources */ = {isa = PBXBuildFile; fileRef = 283372D21BF538BC00D343E4 /* JPEG.swift */; };
283372D51BF538BC00D343E4 /* QuickTimeMov.swift in Sources */ = {isa = PBXBuildFile; fileRef = 283372D31BF538BC00D343E4 /* QuickTimeMov.swift */; };
75C6D54D1FC3C6AF008D8570 /* DTColorMacro.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75C6D54C1FC3C6AF008D8570 /* DTColorMacro.swift */; };
B26BE5051BAF467300A3E194 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B26BE5041BAF467300A3E194 /* AppDelegate.swift */; };
B26BE5071BAF467300A3E194 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B26BE5061BAF467300A3E194 /* ViewController.swift */; };
B26BE50C1BAF467300A3E194 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B26BE50B1BAF467300A3E194 /* Assets.xcassets */; };
Expand All @@ -20,6 +21,7 @@
/* Begin PBXFileReference section */
283372D21BF538BC00D343E4 /* JPEG.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JPEG.swift; path = ../JPEG.swift; sourceTree = "<group>"; };
283372D31BF538BC00D343E4 /* QuickTimeMov.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = QuickTimeMov.swift; path = ../QuickTimeMov.swift; sourceTree = "<group>"; };
75C6D54C1FC3C6AF008D8570 /* DTColorMacro.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DTColorMacro.swift; sourceTree = "<group>"; };
B26BE5011BAF467300A3E194 /* LivePhotoDemoSwift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LivePhotoDemoSwift.app; sourceTree = BUILT_PRODUCTS_DIR; };
B26BE5041BAF467300A3E194 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
B26BE5061BAF467300A3E194 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; wrapsLines = 0; };
Expand All @@ -41,6 +43,14 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
75673D561FC2D30F00D9B150 /* Macro */ = {
isa = PBXGroup;
children = (
75C6D54C1FC3C6AF008D8570 /* DTColorMacro.swift */,
);
path = Macro;
sourceTree = "<group>";
};
B26BE4F81BAF467300A3E194 = {
isa = PBXGroup;
children = (
Expand All @@ -61,6 +71,7 @@
B26BE5031BAF467300A3E194 /* LivePhotoDemoSwift */ = {
isa = PBXGroup;
children = (
75673D561FC2D30F00D9B150 /* Macro */,
B26BE5041BAF467300A3E194 /* AppDelegate.swift */,
B26BE5061BAF467300A3E194 /* ViewController.swift */,
283372D21BF538BC00D343E4 /* JPEG.swift */,
Expand Down Expand Up @@ -100,12 +111,13 @@
B26BE4F91BAF467300A3E194 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0710;
LastUpgradeCheck = 0910;
ORGANIZATIONNAME = "Genady Okrain";
TargetAttributes = {
B26BE5001BAF467300A3E194 = {
CreatedOnToolsVersion = 7.1;
LastSwiftMigration = 0820;
DevelopmentTeam = H8J36KWCJF;
LastSwiftMigration = 0910;
};
};
};
Expand Down Expand Up @@ -149,6 +161,7 @@
B26BE5071BAF467300A3E194 /* ViewController.swift in Sources */,
283372D51BF538BC00D343E4 /* QuickTimeMov.swift in Sources */,
B26BE5051BAF467300A3E194 /* AppDelegate.swift in Sources */,
75C6D54D1FC3C6AF008D8570 /* DTColorMacro.swift in Sources */,
283372D41BF538BC00D343E4 /* JPEG.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -175,13 +188,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand Down Expand Up @@ -219,13 +240,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand All @@ -244,6 +273,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -253,12 +283,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = H8J36KWCJF;
INFOPLIST_FILE = LivePhotoDemoSwift/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.okrain.LivePhotoDemoSwift;
PRODUCT_BUNDLE_IDENTIFIER = com.okrain.LivePhotoDemoSwift2;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -267,11 +299,13 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = H8J36KWCJF;
INFOPLIST_FILE = LivePhotoDemoSwift/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.okrain.LivePhotoDemoSwift;
PRODUCT_BUNDLE_IDENTIFIER = com.okrain.LivePhotoDemoSwift2;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
Empty file.
Empty file modified LivePhotoDemoSwift/AppDelegate.swift 100644 → 100755
Empty file.
Empty file.
Empty file modified LivePhotoDemoSwift/Base.lproj/LaunchScreen.storyboard 100644 → 100755
Empty file.
6 changes: 6 additions & 0 deletions LivePhotoDemoSwift/Info.plist 100644 → 100755
Expand Up @@ -22,6 +22,12 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string></string>
<key>NSMicrophoneUsageDescription</key>
<string></string>
<key>NSPhotoLibraryUsageDescription</key>
<string></string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand Down
Empty file modified LivePhotoDemoSwift/JPEG.swift 100644 → 100755
Empty file.
30 changes: 30 additions & 0 deletions LivePhotoDemoSwift/Macro/DTColorMacro.swift
@@ -0,0 +1,30 @@
//
// DTColorMacro.swift
// 动图
//
// Created by 孙国林 on 2017/11/8.
// Copyright © 2017年 欧巴刚弄死他. All rights reserved.
//

import UIKit

public func HEXACOLOR(value : UInt, alpha : CGFloat) -> UIColor {
return UIColor.init(red: CGFloat((value & 0xff0000) >> 16) / 255.0,
green: CGFloat((value & 0xff00) >> 8) / 255.0,
blue: CGFloat(value & 0xff) / 255.0,
alpha: alpha)
}

public func HEXCOLOR(value : UInt) -> UIColor {
return HEXACOLOR(value: value, alpha: 1)
}

public func RGBACOLOR(red : UInt, green : UInt, blue : UInt, alpha : CGFloat) -> UIColor {
return UIColor.init(red: CGFloat(red) / 255.0, green: CGFloat(green) / 255.0, blue: CGFloat(blue) / 255.0, alpha: alpha)
}

public func RGBCOLOR(red : UInt, green : UInt, blue : UInt) -> UIColor {
return RGBACOLOR(red: red, green: green, blue: blue, alpha: 1)
}


Empty file modified LivePhotoDemoSwift/Main.storyboard 100644 → 100755
Empty file.
Empty file modified LivePhotoDemoSwift/QuickTimeMov.swift 100644 → 100755
Empty file.
29 changes: 13 additions & 16 deletions LivePhotoDemoSwift/ViewController.swift
Expand Up @@ -57,14 +57,16 @@ class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavig

//self?.livePhotoView.livePhoto = LPDLivePhoto.livePhotoWithImageURL(NSURL(fileURLWithPath: FilePaths.VidToLive.livePath.stringByAppendingString("/IMG.JPG")), videoURL: NSURL(fileURLWithPath: FilePaths.VidToLive.livePath.stringByAppendingString("/IMG.MOV")))
//self?.exportLivePhoto()
PHLivePhoto.request(withResourceFileURLs: [ URL(fileURLWithPath: FilePaths.VidToLive.livePath + "/IMG.MOV"), URL(fileURLWithPath: FilePaths.VidToLive.livePath + "/IMG.JPG")],
placeholderImage: nil,
targetSize: self!.view.bounds.size,
contentMode: PHImageContentMode.aspectFit,
resultHandler: { (livePhoto, info) -> Void in
self?.livePhotoView.livePhoto = livePhoto
self?.exportLivePhoto()
})
_ = DispatchQueue.main.sync {
PHLivePhoto.request(withResourceFileURLs: [ URL(fileURLWithPath: FilePaths.VidToLive.livePath + "/IMG.MOV"), URL(fileURLWithPath: FilePaths.VidToLive.livePath + "/IMG.JPG")],
placeholderImage: nil,
targetSize: self!.view.bounds.size,
contentMode: PHImageContentMode.aspectFit,
resultHandler: { (livePhoto, info) -> Void in
self?.livePhotoView.livePhoto = livePhoto
self?.exportLivePhoto()
})
}
}
}
}
Expand Down Expand Up @@ -95,15 +97,10 @@ class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavig
creationRequest.addResource(with: PHAssetResourceType.photo, fileURL: URL(fileURLWithPath: FilePaths.VidToLive.livePath + "/IMG.JPG"), options: options)

}, completionHandler: { (success, error) -> Void in
print(success)
print(error)

if !success {
DTLog((error?.localizedDescription)!)
}
})



}


}

Empty file modified LivePhotoDemoSwift/video.m4v 100644 → 100755
Empty file.

0 comments on commit 14dc278

Please sign in to comment.