Merge pull request #109 from nohana/Swift4.2

Swift4.2
This commit is contained in:
Kazushi Hara 2018-10-14 22:42:54 +09:00 committed by GitHub
commit 42e4b4fcf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 37 additions and 27 deletions

View File

@ -1 +1 @@
4.0
4.2

View File

@ -314,7 +314,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = nohana;
TargetAttributes = {
F208E5501CD7370B00FFC9F6 = {
@ -498,12 +498,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@ -556,12 +558,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@ -613,7 +617,7 @@
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
@ -634,7 +638,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@ -56,7 +55,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"

View File

@ -23,22 +23,22 @@ class AlbumListEmptyIndicator: UILabel {
centerStyle.alignment = NSTextAlignment.center
let messageAttributes = [
NSAttributedStringKey.foregroundColor : config.color.empty ?? UIColor(red: 0x88/0xff, green: 0x88/0xff, blue: 0x88/0xff, alpha: 1),
NSAttributedStringKey.font : UIFont.systemFont(ofSize: 26),
NSAttributedStringKey.paragraphStyle : centerStyle
NSAttributedString.Key.foregroundColor : config.color.empty ?? UIColor(red: 0x88/0xff, green: 0x88/0xff, blue: 0x88/0xff, alpha: 1),
NSAttributedString.Key.font : UIFont.systemFont(ofSize: 26),
NSAttributedString.Key.paragraphStyle : centerStyle
]
let messageText = NSAttributedString(string: message, attributes: messageAttributes)
let descriptionAttributes = [
NSAttributedStringKey.foregroundColor : config.color.empty ?? UIColor(red: 0x88/0xff, green: 0x88/0xff, blue: 0x88/0xff, alpha: 1),
NSAttributedStringKey.font : UIFont.systemFont(ofSize: 14),
NSAttributedStringKey.paragraphStyle : centerStyle
NSAttributedString.Key.foregroundColor : config.color.empty ?? UIColor(red: 0x88/0xff, green: 0x88/0xff, blue: 0x88/0xff, alpha: 1),
NSAttributedString.Key.font : UIFont.systemFont(ofSize: 14),
NSAttributedString.Key.paragraphStyle : centerStyle
]
let descriptionText = NSAttributedString(string: description, attributes: descriptionAttributes)
let attributedText = NSMutableAttributedString()
attributedText.append(messageText)
attributedText.append(NSAttributedString(string: "\n\n", attributes: [NSAttributedStringKey.font : UIFont.systemFont(ofSize: 6)]))
attributedText.append(NSAttributedString(string: "\n\n", attributes: [NSAttributedString.Key.font : UIFont.systemFont(ofSize: 6)]))
attributedText.append(descriptionText)
self.numberOfLines = 0

View File

@ -240,7 +240,7 @@ class AlbumListViewController: UITableViewController, EmptyIndicatable, Activity
var isLoading = true
func setUpActivityIndicator() {
activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray)
activityIndicator = UIActivityIndicatorView(style: .gray)
let screenRect = Size.screenRectWithoutAppBar(self)
activityIndicator?.center = CGPoint(x: screenRect.size.width / 2, y: screenRect.size.height / 2)
activityIndicator?.startAnimating()
@ -261,7 +261,7 @@ extension UIViewController {
let infoButton = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
infoButton.isEnabled = false
infoButton.setTitleTextAttributes([NSAttributedStringKey.font: UIFont.systemFont(ofSize: 14), NSAttributedStringKey.foregroundColor: UIColor.black], for: UIControlState())
infoButton.setTitleTextAttributes([NSAttributedString.Key.font: UIFont.systemFont(ofSize: 14), NSAttributedString.Key.foregroundColor: UIColor.black], for: UIControl.State())
self.toolbarItems = [leftSpace, infoButton, rightSpace]
}

View File

@ -25,7 +25,7 @@ class AnimatableNavigationController: UINavigationController, UINavigationContro
self.delegate = self
}
func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationController.Operation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
switch operation {
case .push where fromVC is AssetListViewController:

View File

@ -30,7 +30,7 @@ class AssetCell: UICollectionViewCell {
let droppedImage: UIImage? = nohanaImagePickerController.config.image.droppedSmall ?? UIImage(named: "btn_select_m", in: nohanaImagePickerController.assetBundle, compatibleWith: nil)
let pickedImage: UIImage? = nohanaImagePickerController.config.image.pickedSmall ?? UIImage(named: "btn_selected_m", in: nohanaImagePickerController.assetBundle, compatibleWith: nil)
pickButton.setImage(droppedImage, for: UIControlState())
pickButton.setImage(droppedImage, for: UIControl.State())
pickButton.setImage(pickedImage, for: .selected)
}
}

View File

@ -38,7 +38,7 @@ class AssetDetailListViewController: AssetListViewController {
let droppedImage: UIImage? = nohanaImagePickerController.config.image.droppedLarge ?? UIImage(named: "btn_select_l", in: nohanaImagePickerController.assetBundle, compatibleWith: nil)
let pickedImage: UIImage? = nohanaImagePickerController.config.image.pickedLarge ?? UIImage(named: "btn_selected_l", in: nohanaImagePickerController.assetBundle, compatibleWith: nil)
pickButton.setImage(droppedImage, for: UIControlState())
pickButton.setImage(droppedImage, for: UIControl.State())
pickButton.setImage(pickedImage, for: .selected)
}
}
@ -76,7 +76,7 @@ class AssetDetailListViewController: AssetListViewController {
}
DispatchQueue.main.async {
let toIndexPath = IndexPath(item: indexPath.item, section: 0)
self.collectionView?.scrollToItem(at: toIndexPath, at: UICollectionViewScrollPosition.centeredHorizontally, animated: false)
self.collectionView?.scrollToItem(at: toIndexPath, at: UICollectionView.ScrollPosition.centeredHorizontally, animated: false)
}
}

View File

@ -35,7 +35,7 @@ class AssetListViewController: UICollectionViewController, UICollectionViewDeleg
return CGSize.zero
}
var numberOfColumns = nohanaImagePickerController.numberOfColumnsInLandscape
if UIInterfaceOrientationIsPortrait(UIApplication.shared.statusBarOrientation) {
if UIApplication.shared.statusBarOrientation.isPortrait {
numberOfColumns = nohanaImagePickerController.numberOfColumnsInPortrait
}
let cellMargin: CGFloat = 2

View File

@ -77,7 +77,7 @@ class ContractingAnimationController: NSObject, UIViewControllerAnimatedTransiti
UIView.animate(
withDuration: transitionDuration(using: transitionContext),
delay: 0,
options: UIViewAnimationOptions(),
options: UIView.AnimationOptions(),
animations: {
toVC.view.alpha = 1
contractingImageView.frame = Size.contractingAnimationToCellRect(toVC, toCell: toCell)

View File

@ -99,7 +99,7 @@ class MomentViewController: AssetListViewController, ActivityIndicatable {
override func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
switch kind {
case UICollectionElementKindSectionHeader:
case UICollectionView.elementKindSectionHeader:
let album = momentAlbumList[indexPath.section]
guard let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "MomentHeader", for: indexPath) as? MomentSectionHeaderView else {
fatalError("failed to create MomentHeader")
@ -125,7 +125,7 @@ class MomentViewController: AssetListViewController, ActivityIndicatable {
var isLoading = true
func setUpActivityIndicator() {
activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray)
activityIndicator = UIActivityIndicatorView(style: .gray)
let screenRect = Size.screenRectWithoutAppBar(self)
activityIndicator?.center = CGPoint(x: screenRect.size.width / 2, y: screenRect.size.height / 2)
activityIndicator?.startAnimating()

View File

@ -106,9 +106,9 @@ open class NohanaImagePickerController: UIViewController {
guard let navigationController = storyboard.instantiateViewController(withIdentifier: viewControllerId) as? UINavigationController else {
fatalError("navigationController init failed.")
}
addChildViewController(navigationController)
addChild(navigationController)
view.addSubview(navigationController.view)
navigationController.didMove(toParentViewController: self)
navigationController.didMove(toParent: self)
// setup albumListViewController
guard let albumListViewController = navigationController.topViewController as? AlbumListViewController else {

View File

@ -19,7 +19,7 @@ import Photos
open class PhotoKitAssetList: ItemList {
fileprivate let mediaType: MediaType
open let assetList: PHAssetCollection
public let assetList: PHAssetCollection
fileprivate var fetchResult: PHFetchResult<PHAsset>!
init(album: PHAssetCollection, mediaType: MediaType) {