From 459fd153849b48315df91d65e4f81167418b2920 Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Wed, 24 Jun 2015 15:29:54 -0700 Subject: [PATCH] Updated to Swift 1.2 --- .../ImagesViewController.swift | 4 ++-- Source/Info.plist | 0 Source/RMAlbumCell.swift | 0 Source/RMAlbumCell.xib | 0 Source/RMAlbumPickerController.swift | 8 ++++---- Source/RMAssetCell.swift | 0 Source/RMAssetCollectionPicker.swift | 18 +++++++++--------- Source/RMImagePicker.h | 0 Source/RMImagePickerController.swift | 2 +- .../tick_deselected.imageset/Contents.json | 0 .../tick_deselected.png | Bin .../tick_deselected@2x.png | Bin .../tick_deselected@3x.png | Bin .../tick_selected.imageset/Contents.json | 0 .../tick_selected.imageset/tick_selected.png | Bin .../tick_selected@2x.png | Bin .../tick_selected@3x.png | Bin Source/RMPlaceholderView.xib | 0 18 files changed, 16 insertions(+), 16 deletions(-) mode change 100644 => 100755 Example/RMImagePickerExample/ImagesViewController.swift mode change 100644 => 100755 Source/Info.plist mode change 100644 => 100755 Source/RMAlbumCell.swift mode change 100644 => 100755 Source/RMAlbumCell.xib mode change 100644 => 100755 Source/RMAlbumPickerController.swift mode change 100644 => 100755 Source/RMAssetCell.swift mode change 100644 => 100755 Source/RMAssetCollectionPicker.swift mode change 100644 => 100755 Source/RMImagePicker.h mode change 100644 => 100755 Source/RMImagePickerController.swift mode change 100644 => 100755 Source/RMImages.xcassets/tick_deselected.imageset/Contents.json mode change 100644 => 100755 Source/RMImages.xcassets/tick_deselected.imageset/tick_deselected.png mode change 100644 => 100755 Source/RMImages.xcassets/tick_deselected.imageset/tick_deselected@2x.png mode change 100644 => 100755 Source/RMImages.xcassets/tick_deselected.imageset/tick_deselected@3x.png mode change 100644 => 100755 Source/RMImages.xcassets/tick_selected.imageset/Contents.json mode change 100644 => 100755 Source/RMImages.xcassets/tick_selected.imageset/tick_selected.png mode change 100644 => 100755 Source/RMImages.xcassets/tick_selected.imageset/tick_selected@2x.png mode change 100644 => 100755 Source/RMImages.xcassets/tick_selected.imageset/tick_selected@3x.png mode change 100644 => 100755 Source/RMPlaceholderView.xib diff --git a/Example/RMImagePickerExample/ImagesViewController.swift b/Example/RMImagePickerExample/ImagesViewController.swift old mode 100644 new mode 100755 index fc3b978..9c61950 --- a/Example/RMImagePickerExample/ImagesViewController.swift +++ b/Example/RMImagePickerExample/ImagesViewController.swift @@ -53,7 +53,7 @@ class ImagesViewController: UICollectionViewController, RMImagePickerControllerD } override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { - let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as UICollectionViewCell + let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! UICollectionViewCell // Configure the cell let asset = self.assets[indexPath.item] @@ -63,7 +63,7 @@ class ImagesViewController: UICollectionViewController, RMImagePickerControllerD contentMode: PHImageContentMode.AspectFit, options: nil, resultHandler: { (image, info) -> Void in - let imageView = cell.viewWithTag(cellImageViewTag) as UIImageView + let imageView = cell.viewWithTag(cellImageViewTag) as! UIImageView imageView.image = image }) return cell diff --git a/Source/Info.plist b/Source/Info.plist old mode 100644 new mode 100755 diff --git a/Source/RMAlbumCell.swift b/Source/RMAlbumCell.swift old mode 100644 new mode 100755 diff --git a/Source/RMAlbumCell.xib b/Source/RMAlbumCell.xib old mode 100644 new mode 100755 diff --git a/Source/RMAlbumPickerController.swift b/Source/RMAlbumPickerController.swift old mode 100644 new mode 100755 index a5c3f31..da79c7e --- a/Source/RMAlbumPickerController.swift +++ b/Source/RMAlbumPickerController.swift @@ -105,7 +105,7 @@ class RMAlbumPickerController: UITableViewController, RMAssetSelectionDelegate, if let reCell = tableView.dequeueReusableCellWithIdentifier(albumCellIdentifier, forIndexPath: indexPath) as? RMAlbumCell { cell = reCell } else { - cell = NSBundle(forClass: RMAlbumPickerController.self).loadNibNamed("RMAlbumCell", owner: self, options: nil)[0] as RMAlbumCell + cell = NSBundle(forClass: RMAlbumPickerController.self).loadNibNamed("RMAlbumCell", owner: self, options: nil)[0] as! RMAlbumCell } // Increment the cell's tag @@ -113,7 +113,7 @@ class RMAlbumPickerController: UITableViewController, RMAssetSelectionDelegate, cell.tag = currentTag // Configure the cell... - let collection = self.allCollections[indexPath.section][indexPath.row] as PHAssetCollection + let collection = self.allCollections[indexPath.section][indexPath.row] as! PHAssetCollection var assetsCount: Int var keyAssets: PHFetchResult! if collection.assetCollectionType == .SmartAlbum { @@ -131,7 +131,7 @@ class RMAlbumPickerController: UITableViewController, RMAssetSelectionDelegate, for (idx, poster) in enumerate(cell.posterImgs) { if idx < keyAssets.count { self.imageManager.requestImageForAsset( - keyAssets[idx] as PHAsset, + keyAssets[idx] as! PHAsset, targetSize: CGSizeMake(imageWidth, imageHeight), contentMode: .AspectFill, options: nil, @@ -157,7 +157,7 @@ class RMAlbumPickerController: UITableViewController, RMAssetSelectionDelegate, override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { let phFetchOptions = PHFetchOptions() phFetchOptions.predicate = NSPredicate(format: "mediaType = %i", PHAssetMediaType.Image.rawValue) - let collection = self.allCollections[indexPath.section][indexPath.row] as PHAssetCollection + let collection = self.allCollections[indexPath.section][indexPath.row] as! PHAssetCollection let assets = PHAsset.fetchAssetsInAssetCollection(collection, options: phFetchOptions) if assets.count > 0 { let picker = RMAssetCollectionPicker() diff --git a/Source/RMAssetCell.swift b/Source/RMAssetCell.swift old mode 100644 new mode 100755 diff --git a/Source/RMAssetCollectionPicker.swift b/Source/RMAssetCollectionPicker.swift old mode 100644 new mode 100755 index 61a03e5..078d763 --- a/Source/RMAssetCollectionPicker.swift +++ b/Source/RMAssetCollectionPicker.swift @@ -53,7 +53,7 @@ class RMAssetCollectionPicker: UICollectionViewController, PHPhotoLibraryChangeO } } - convenience override init() { + convenience init() { let layout = UICollectionViewFlowLayout() layout.scrollDirection = UICollectionViewScrollDirection.Vertical layout.minimumInteritemSpacing = AssetsSpacing @@ -62,7 +62,7 @@ class RMAssetCollectionPicker: UICollectionViewController, PHPhotoLibraryChangeO self.init(collectionViewLayout: layout) } - override init(collectionViewLayout layout: UICollectionViewLayout!) { + override init(collectionViewLayout layout: UICollectionViewLayout) { super.init(collectionViewLayout: layout) self.imageManager = PHCachingImageManager() self.resetCachedAssets() @@ -82,7 +82,7 @@ class RMAssetCollectionPicker: UICollectionViewController, PHPhotoLibraryChangeO self.collectionView?.allowsMultipleSelection = true let scale = UIScreen.mainScreen().scale - let cellSize = (self.collectionViewLayout as UICollectionViewFlowLayout).itemSize + let cellSize = (self.collectionViewLayout as! UICollectionViewFlowLayout).itemSize AssetGridThumbnailSize = CGSize(width: cellSize.width * scale, height: cellSize.height * scale) let doneButtonItem = UIBarButtonItem( @@ -103,13 +103,13 @@ class RMAssetCollectionPicker: UICollectionViewController, PHPhotoLibraryChangeO ) let selectAllItem = UIBarButtonItem( title: NSLocalizedString("Select all", comment: ""), - style: UIBarButtonItemStyle.Bordered, + style: UIBarButtonItemStyle.Plain, target: self, action: "selectAllAction:" ) let deselectAllItem = UIBarButtonItem( title: NSLocalizedString("Deselect all", comment: ""), - style: UIBarButtonItemStyle.Bordered, + style: UIBarButtonItemStyle.Plain, target: self, action: "deselectAllAction:" ) @@ -157,13 +157,13 @@ class RMAssetCollectionPicker: UICollectionViewController, PHPhotoLibraryChangeO } override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { - let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as RMAssetCell + let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! RMAssetCell // Increment the cell's tag let currentTag = cell.tag + 1 cell.tag = currentTag - let asset: PHAsset! = self.assetsFetchResult[indexPath.item] as PHAsset + let asset: PHAsset! = self.assetsFetchResult[indexPath.item] as! PHAsset self.imageManager.requestImageForAsset( asset, targetSize: AssetGridThumbnailSize, @@ -311,7 +311,7 @@ class RMAssetCollectionPicker: UICollectionViewController, PHPhotoLibraryChangeO func assetsAtIndexPaths(indexPaths: [NSIndexPath]) -> [PHAsset] { var assets: [PHAsset] = [] for indexPath in indexPaths { - assets.append(self.assetsFetchResult[indexPath.item] as PHAsset) + assets.append(self.assetsFetchResult[indexPath.item] as! PHAsset) } return assets } @@ -344,7 +344,7 @@ class RMAssetCollectionPicker: UICollectionViewController, PHPhotoLibraryChangeO func doneAction(sender: AnyObject) { var selectedAssets: [PHAsset] = [] for ip in self.collectionView!.indexPathsForSelectedItems() { - selectedAssets.append(self.assetsFetchResult[ip.item] as PHAsset) + selectedAssets.append(self.assetsFetchResult[ip.item] as! PHAsset) } assetsParent?.selectedAssets(selectedAssets) } diff --git a/Source/RMImagePicker.h b/Source/RMImagePicker.h old mode 100644 new mode 100755 diff --git a/Source/RMImagePickerController.swift b/Source/RMImagePickerController.swift old mode 100644 new mode 100755 index c223e58..453fc4c --- a/Source/RMImagePickerController.swift +++ b/Source/RMImagePickerController.swift @@ -22,7 +22,7 @@ public class RMImagePickerController: UINavigationController, RMAssetSelectionDe super.init(rootViewController: rootViewController) } - public override convenience init() { + public convenience init() { var albumController = RMAlbumPickerController() self.init(rootViewController: albumController) albumController.assetsParent = self diff --git a/Source/RMImages.xcassets/tick_deselected.imageset/Contents.json b/Source/RMImages.xcassets/tick_deselected.imageset/Contents.json old mode 100644 new mode 100755 diff --git a/Source/RMImages.xcassets/tick_deselected.imageset/tick_deselected.png b/Source/RMImages.xcassets/tick_deselected.imageset/tick_deselected.png old mode 100644 new mode 100755 diff --git a/Source/RMImages.xcassets/tick_deselected.imageset/tick_deselected@2x.png b/Source/RMImages.xcassets/tick_deselected.imageset/tick_deselected@2x.png old mode 100644 new mode 100755 diff --git a/Source/RMImages.xcassets/tick_deselected.imageset/tick_deselected@3x.png b/Source/RMImages.xcassets/tick_deselected.imageset/tick_deselected@3x.png old mode 100644 new mode 100755 diff --git a/Source/RMImages.xcassets/tick_selected.imageset/Contents.json b/Source/RMImages.xcassets/tick_selected.imageset/Contents.json old mode 100644 new mode 100755 diff --git a/Source/RMImages.xcassets/tick_selected.imageset/tick_selected.png b/Source/RMImages.xcassets/tick_selected.imageset/tick_selected.png old mode 100644 new mode 100755 diff --git a/Source/RMImages.xcassets/tick_selected.imageset/tick_selected@2x.png b/Source/RMImages.xcassets/tick_selected.imageset/tick_selected@2x.png old mode 100644 new mode 100755 diff --git a/Source/RMImages.xcassets/tick_selected.imageset/tick_selected@3x.png b/Source/RMImages.xcassets/tick_selected.imageset/tick_selected@3x.png old mode 100644 new mode 100755 diff --git a/Source/RMPlaceholderView.xib b/Source/RMPlaceholderView.xib old mode 100644 new mode 100755