回答編集履歴

3

追加。

2017/07/03 05:53

投稿

fuzzball
fuzzball

スコア16731

test CHANGED
@@ -47,3 +47,19 @@
47
47
  `PHFetchOptions`を使ったら、もう少し効率良く出来るかもしれませんが。
48
48
 
49
49
 
50
+
51
+ # 質問編集後の回答
52
+
53
+
54
+
55
+ ```swift
56
+
57
+ self.photosImg = [image!]
58
+
59
+ ```
60
+
61
+
62
+
63
+ 上書きになっているので、追加にして下さい。
64
+
65
+

2

言い訳。

2017/07/03 05:53

投稿

fuzzball
fuzzball

スコア16731

test CHANGED
@@ -43,3 +43,7 @@
43
43
  ```
44
44
 
45
45
 
46
+
47
+ `PHFetchOptions`を使ったら、もう少し効率良く出来るかもしれませんが。
48
+
49
+

1

コード追記。

2017/07/03 04:13

投稿

fuzzball
fuzzball

スコア16731

test CHANGED
@@ -5,3 +5,41 @@
5
5
 
6
6
 
7
7
  参考になれば。
8
+
9
+
10
+
11
+ 【追記】
12
+
13
+
14
+
15
+ ```swift
16
+
17
+ let collections = PHAssetCollection.fetchAssetCollections(with: .album, subtype: .albumRegular, options: nil)
18
+
19
+ collections.enumerateObjects { (collection: PHAssetCollection, index: Int, stop) in
20
+
21
+ print(index, collection)
22
+
23
+ if collection.localizedTitle == "hoge" { //アルバム名
24
+
25
+ let assets = PHAsset.fetchAssets(in: collection, options: nil)
26
+
27
+ assets.enumerateObjects({ (asset, index, stop) in
28
+
29
+ print(index, asset)
30
+
31
+ })
32
+
33
+ //stop.pointee = true //同じ名前のアルバムが複数存在出来るようなのでstopしない
34
+
35
+ } else {
36
+
37
+ print(index, "skip")
38
+
39
+ }
40
+
41
+ }
42
+
43
+ ```
44
+
45
+