Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
P
PhoneManager
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yang
PhoneManager
Commits
21848fa1
Commit
21848fa1
authored
May 12, 2025
by
shenyong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
引入新相册资源管理类
parent
a3d9d9ea
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
3092 additions
and
74 deletions
+3092
-74
IAPManager.swift
PhoneManager/Class/Manager/IAPManager/IAPManager.swift
+0
-0
ActorManager.swift
PhoneManager/Class/Manager/PMPhotoManager/ActorManager.swift
+253
-0
PhotoDuplicateManager.swift
.../Class/Manager/PMPhotoManager/PhotoDuplicateManager.swift
+301
-0
PhotoManager.swift
PhoneManager/Class/Manager/PMPhotoManager/PhotoManager.swift
+437
-0
PhotoModel.swift
PhoneManager/Class/Manager/PMPhotoManager/PhotoModel.swift
+91
-0
PhotoSimilarManager.swift
...er/Class/Manager/PMPhotoManager/PhotoSimilarManager.swift
+679
-0
ScreenShotSimilarManager.swift
...ass/Manager/PMPhotoManager/ScreenShotSimilarManager.swift
+573
-0
VideoSimilarManager.swift
...er/Class/Manager/PMPhotoManager/VideoSimilarManager.swift
+673
-0
HomePhotosModel .swift
...Manager/Class/Page/Home/View/Model/HomePhotosModel .swift
+22
-22
TrashViewController.swift
...ger/Class/Page/Trash/Controller/TrashViewController.swift
+35
-37
TrashContenAssetCell.swift
...eManager/Class/Page/Trash/View/TrashContenAssetCell.swift
+13
-0
TrashContenView.swift
PhoneManager/Class/Page/Trash/View/TrashContenView.swift
+15
-15
No files found.
PhoneManager/Class/Manager/IAPManager.swift
→
PhoneManager/Class/Manager/IAPManager
/IAPManager
.swift
View file @
21848fa1
File moved
PhoneManager/Class/Manager/PMPhotoManager/ActorManager.swift
0 → 100644
View file @
21848fa1
//
// ActorManager.swift
// CleanPhoto
//
// Created by edy on 2025/5/9.
//
import
Foundation
import
UIKit
// 图片状态管理 actor
actor
PhotoSimilarStateManager
{
private
var
timeGroups
:
[
TimeGroupModel
]
=
[]
private
var
similarGroups
:
[
SimilarGroupModel
]
=
[]
private
var
pendingSimilarGroups
:
[
SimilarGroupModel
]
=
[]
private
var
processedGroupCount
:
Int
=
0
private
var
assetsImageCache
:
[
String
:
UIImage
]
=
[:]
private
var
hashCache
:
[
String
:
String
]
=
[:]
func
appendTimeGroup
(
_
group
:
TimeGroupModel
)
{
timeGroups
.
append
(
group
)
}
func
appendSimilarGroup
(
_
group
:
SimilarGroupModel
)
{
pendingSimilarGroups
.
append
(
group
)
processedGroupCount
+=
1
}
func
getAllTimeGroups
()
->
[
TimeGroupModel
]
{
return
timeGroups
}
func
getpendingSimilarGroups
()
->
[
SimilarGroupModel
]
{
return
pendingSimilarGroups
}
func
getAllSimilarGroups
()
->
[
SimilarGroupModel
]
{
return
similarGroups
}
func
getCachedImage
(
for
identifier
:
String
)
->
UIImage
?
{
return
assetsImageCache
[
identifier
]
}
func
setCachedImage
(
_
image
:
UIImage
,
for
identifier
:
String
)
{
assetsImageCache
[
identifier
]
=
image
}
func
shouldSavePendingGroups
()
->
Bool
{
return
processedGroupCount
>=
10
}
func
getCachedHash
(
for
identifier
:
String
)
async
->
String
?
{
return
hashCache
[
identifier
]
}
func
setCachedHash
(
_
hash
:
String
,
for
identifier
:
String
)
async
{
hashCache
[
identifier
]
=
hash
}
func
savePendingGroups
()
{
similarGroups
.
append
(
contentsOf
:
pendingSimilarGroups
)
pendingSimilarGroups
.
removeAll
()
processedGroupCount
=
0
}
func
loadStoredData
(
timeGroups
:
[
TimeGroupModel
],
similarGroups
:
[
SimilarGroupModel
])
{
self
.
timeGroups
=
timeGroups
self
.
similarGroups
=
similarGroups
}
}
// 截图状态管理 actor
actor
ScreenshotSimilarStateManager
{
private
var
timeGroups
:
[
TimeGroupModel
]
=
[]
private
var
similarGroups
:
[
SimilarGroupModel
]
=
[]
private
var
pendingSimilarGroups
:
[
SimilarGroupModel
]
=
[]
private
var
processedGroupCount
:
Int
=
0
private
var
assetsImageCache
:
[
String
:
UIImage
]
=
[:]
private
var
hashCache
:
[
String
:
String
]
=
[:]
func
appendTimeGroup
(
_
group
:
TimeGroupModel
)
{
timeGroups
.
append
(
group
)
}
func
appendSimilarGroup
(
_
group
:
SimilarGroupModel
)
{
pendingSimilarGroups
.
append
(
group
)
processedGroupCount
+=
1
}
func
getAllTimeGroups
()
->
[
TimeGroupModel
]
{
return
timeGroups
}
func
getpendingSimilarGroups
()
->
[
SimilarGroupModel
]
{
return
pendingSimilarGroups
}
func
getAllSimilarGroups
()
->
[
SimilarGroupModel
]
{
return
similarGroups
}
func
getCachedImage
(
for
identifier
:
String
)
->
UIImage
?
{
return
assetsImageCache
[
identifier
]
}
func
setCachedImage
(
_
image
:
UIImage
,
for
identifier
:
String
)
{
assetsImageCache
[
identifier
]
=
image
}
func
shouldSavePendingGroups
()
->
Bool
{
return
processedGroupCount
>=
10
}
func
getCachedHash
(
for
identifier
:
String
)
async
->
String
?
{
return
hashCache
[
identifier
]
}
func
setCachedHash
(
_
hash
:
String
,
for
identifier
:
String
)
async
{
hashCache
[
identifier
]
=
hash
}
func
savePendingGroups
()
{
similarGroups
.
append
(
contentsOf
:
pendingSimilarGroups
)
pendingSimilarGroups
.
removeAll
()
processedGroupCount
=
0
}
func
loadStoredData
(
timeGroups
:
[
TimeGroupModel
],
similarGroups
:
[
SimilarGroupModel
])
{
self
.
timeGroups
=
timeGroups
self
.
similarGroups
=
similarGroups
}
}
// 视频状态管理 actor
actor
VideoSimilarStateManager
{
private
var
timeGroups
:
[
TimeGroupModel
]
=
[]
private
var
similarGroups
:
[
SimilarGroupModel
]
=
[]
private
var
pendingSimilarGroups
:
[
SimilarGroupModel
]
=
[]
private
var
processedGroupCount
:
Int
=
0
private
var
assetsImageCache
:
[
String
:
UIImage
]
=
[:]
private
var
hashCache
:
[
String
:
String
]
=
[:]
func
appendTimeGroup
(
_
group
:
TimeGroupModel
)
{
timeGroups
.
append
(
group
)
}
func
appendSimilarGroup
(
_
group
:
SimilarGroupModel
)
{
pendingSimilarGroups
.
append
(
group
)
processedGroupCount
+=
1
}
func
getAllTimeGroups
()
->
[
TimeGroupModel
]
{
return
timeGroups
}
func
getpendingSimilarGroups
()
->
[
SimilarGroupModel
]
{
return
pendingSimilarGroups
}
func
getAllSimilarGroups
()
->
[
SimilarGroupModel
]
{
return
similarGroups
}
func
getCachedImage
(
for
identifier
:
String
)
->
UIImage
?
{
return
assetsImageCache
[
identifier
]
}
func
setCachedImage
(
_
image
:
UIImage
,
for
identifier
:
String
)
{
assetsImageCache
[
identifier
]
=
image
}
func
shouldSavePendingGroups
()
->
Bool
{
return
processedGroupCount
>=
10
}
func
getCachedHash
(
for
identifier
:
String
)
async
->
String
?
{
return
hashCache
[
identifier
]
}
func
setCachedHash
(
_
hash
:
String
,
for
identifier
:
String
)
async
{
hashCache
[
identifier
]
=
hash
}
func
savePendingGroups
()
{
similarGroups
.
append
(
contentsOf
:
pendingSimilarGroups
)
pendingSimilarGroups
.
removeAll
()
processedGroupCount
=
0
}
func
loadStoredData
(
timeGroups
:
[
TimeGroupModel
],
similarGroups
:
[
SimilarGroupModel
])
{
self
.
timeGroups
=
timeGroups
self
.
similarGroups
=
similarGroups
}
}
actor
PhotoDuplicateStateManager
{
private
var
duplicateGroups
:
[
DuplicateGroupModel
]
=
[]
private
var
pendingDuplicateGroups
:
[
DuplicateGroupModel
]
=
[]
// 缓存
private
var
imageCache
:
[
String
:
UIImage
]
=
[:]
private
var
hashCache
:
[
String
:
String
]
=
[:]
// MARK: - 公共方法
func
loadStoredData
(
duplicateGroups
:
[
DuplicateGroupModel
])
{
self
.
duplicateGroups
=
duplicateGroups
}
func
getAllDuplicateGroups
()
->
[
DuplicateGroupModel
]
{
return
duplicateGroups
}
func
appendDuplicateGroup
(
_
group
:
DuplicateGroupModel
)
{
pendingDuplicateGroups
.
append
(
group
)
}
func
shouldSavePendingGroups
()
->
Bool
{
return
pendingDuplicateGroups
.
count
>=
5
}
func
savePendingGroups
()
{
duplicateGroups
.
append
(
contentsOf
:
pendingDuplicateGroups
)
pendingDuplicateGroups
.
removeAll
()
}
func
getPendingDuplicateGroups
()
->
[
DuplicateGroupModel
]
{
return
pendingDuplicateGroups
}
// MARK: - 缓存相关
func
getCachedImage
(
for
identifier
:
String
)
->
UIImage
?
{
return
imageCache
[
identifier
]
}
func
setCachedImage
(
_
image
:
UIImage
,
for
identifier
:
String
)
{
imageCache
[
identifier
]
=
image
}
func
getCachedHash
(
for
identifier
:
String
)
->
String
?
{
return
hashCache
[
identifier
]
}
func
setCachedHash
(
_
hash
:
String
,
for
identifier
:
String
)
{
hashCache
[
identifier
]
=
hash
}
}
PhoneManager/Class/Manager/PMPhotoManager/PhotoDuplicateManager.swift
0 → 100644
View file @
21848fa1
This diff is collapsed.
Click to expand it.
PhoneManager/Class/Manager/PMPhotoManager/PhotoManager.swift
0 → 100644
View file @
21848fa1
This diff is collapsed.
Click to expand it.
PhoneManager/Class/Manager/PMPhotoManager/PhotoModel.swift
0 → 100644
View file @
21848fa1
//
// AssetModel.swift
// CleanPhoto
//
// Created by edy on 2025/5/7.
//
import
Foundation
struct
AssetModel
:
Codable
,
Hashable
{
var
localIdentifier
:
String
var
assetSize
:
Double
var
createDate
:
Date
var
mediaType
:
Int
// 1 图片 2视频
init
(
localIdentifier
:
String
,
assetSize
:
Double
,
createDate
:
Date
,
mediaType
:
Int
=
1
)
{
self
.
localIdentifier
=
localIdentifier
self
.
assetSize
=
assetSize
self
.
createDate
=
createDate
self
.
mediaType
=
mediaType
}
func
hash
(
into
hasher
:
inout
Hasher
)
{
hasher
.
combine
(
localIdentifier
)
hasher
.
combine
(
assetSize
)
hasher
.
combine
(
createDate
)
hasher
.
combine
(
mediaType
)
}
static
func
==
(
lhs
:
AssetModel
,
rhs
:
AssetModel
)
->
Bool
{
return
lhs
.
localIdentifier
==
rhs
.
localIdentifier
&&
lhs
.
assetSize
==
rhs
.
assetSize
&&
lhs
.
createDate
==
rhs
.
createDate
&&
lhs
.
mediaType
==
rhs
.
mediaType
}
}
struct
AssetFileModel
:
Codable
{
var
videoAssets
:[
AssetModel
]
=
[]
var
otherAssets
:[
AssetModel
]
=
[]
var
screenShotAssets
:[
AssetModel
]
=
[]
var
photosAssets
:[
AssetModel
]
=
[]
}
// 添加媒体类型枚举
enum
MediaType
{
case
video
case
screenshot
case
photo
case
other
}
extension
MediaType
{
var
dbValue
:
String
{
switch
self
{
case
.
video
:
return
"video"
case
.
screenshot
:
return
"screenshot"
case
.
photo
:
return
"photo"
case
.
other
:
return
"other"
}
}
}
// 时间组模型
struct
TimeGroupModel
:
Codable
{
let
groupId
:
String
let
startTime
:
TimeInterval
let
endTime
:
TimeInterval
var
isProcessed
:
Bool
}
// 相似图片组模型
struct
SimilarGroupModel
:
Codable
{
let
groupId
:
String
var
assets
:
[
AssetModel
]
}
// 重复图片组模型
struct
DuplicateGroupModel
:
Codable
{
let
groupId
:
String
let
assets
:
[
AssetModel
]
}
PhoneManager/Class/Manager/PMPhotoManager/PhotoSimilarManager.swift
0 → 100644
View file @
21848fa1
This diff is collapsed.
Click to expand it.
PhoneManager/Class/Manager/PMPhotoManager/ScreenShotSimilarManager.swift
0 → 100644
View file @
21848fa1
This diff is collapsed.
Click to expand it.
PhoneManager/Class/Manager/PMPhotoManager/VideoSimilarManager.swift
0 → 100644
View file @
21848fa1
This diff is collapsed.
Click to expand it.
PhoneManager/Class/Page/Home/View/Model/HomePhotosModel .swift
View file @
21848fa1
...
@@ -358,28 +358,28 @@ class HomePhotosModel:Codable {
...
@@ -358,28 +358,28 @@ class HomePhotosModel:Codable {
}
}
class
AssetModel
:
Codable
,
Hashable
{
//
class AssetModel :Codable,Hashable {
var
localIdentifier
:
String
//
var localIdentifier : String
var
assetSize
:
Double
//
var assetSize : Double
var
createDate
:
Date
//
var createDate : Date
init
(
localIdentifier
:
String
,
assetSize
:
Double
,
createDate
:
Date
)
{
//
init(localIdentifier: String, assetSize: Double, createDate: Date) {
self
.
localIdentifier
=
localIdentifier
//
self.localIdentifier = localIdentifier
self
.
assetSize
=
assetSize
//
self.assetSize = assetSize
self
.
createDate
=
createDate
//
self.createDate = createDate
}
//
}
//
func
hash
(
into
hasher
:
inout
Hasher
)
{
//
func hash(into hasher: inout Hasher) {
hasher
.
combine
(
localIdentifier
)
//
hasher.combine(localIdentifier)
hasher
.
combine
(
assetSize
)
//
hasher.combine(assetSize)
hasher
.
combine
(
createDate
)
//
hasher.combine(createDate)
}
//
}
//
static
func
==
(
lhs
:
AssetModel
,
rhs
:
AssetModel
)
->
Bool
{
//
static func ==(lhs: AssetModel, rhs: AssetModel) -> Bool {
return
lhs
.
localIdentifier
==
rhs
.
localIdentifier
&&
//
return lhs.localIdentifier == rhs.localIdentifier &&
lhs
.
assetSize
==
rhs
.
assetSize
&&
//
lhs.assetSize == rhs.assetSize &&
lhs
.
createDate
==
rhs
.
createDate
//
lhs.createDate == rhs.createDate
}
//
}
}
//
}
PhoneManager/Class/Page/Trash/Controller/TrashViewController.swift
View file @
21848fa1
...
@@ -21,10 +21,10 @@ class TrashViewController: UIViewController {
...
@@ -21,10 +21,10 @@ class TrashViewController: UIViewController {
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
configUI
()
configUI
()
}
}
func
configUI
(){
func
configUI
(){
view
.
backgroundColor
=
.
white
view
.
backgroundColor
=
.
white
contentScrollView
=
UIScrollView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
ScreenW
,
height
:
contentH
))
contentScrollView
=
UIScrollView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
ScreenW
,
height
:
contentH
))
...
@@ -79,7 +79,6 @@ class TrashViewController: UIViewController {
...
@@ -79,7 +79,6 @@ class TrashViewController: UIViewController {
otherView
.
frame
=
CGRect
(
x
:
viewWidth
,
y
:
0
,
width
:
viewWidth
,
height
:
contentH
)
otherView
.
frame
=
CGRect
(
x
:
viewWidth
,
y
:
0
,
width
:
viewWidth
,
height
:
contentH
)
shotView
.
frame
=
CGRect
(
x
:
viewWidth
*
2
,
y
:
0
,
width
:
viewWidth
,
height
:
contentH
)
shotView
.
frame
=
CGRect
(
x
:
viewWidth
*
2
,
y
:
0
,
width
:
viewWidth
,
height
:
contentH
)
chatView
.
frame
=
CGRect
(
x
:
viewWidth
*
3
,
y
:
0
,
width
:
viewWidth
,
height
:
contentH
)
chatView
.
frame
=
CGRect
(
x
:
viewWidth
*
3
,
y
:
0
,
width
:
viewWidth
,
height
:
contentH
)
}
}
lazy
var
videoView
:
TrashContenView
=
{
lazy
var
videoView
:
TrashContenView
=
{
...
@@ -107,44 +106,46 @@ class TrashViewController: UIViewController {
...
@@ -107,44 +106,46 @@ class TrashViewController: UIViewController {
}()
}()
lazy
var
collectionView
:
UICollectionView
=
{
let
layout
=
UICollectionViewFlowLayout
()
layout
.
itemSize
=
CGSize
(
width
:
view
.
width
,
height
:
view
.
height
)
layout
.
scrollDirection
=
.
horizontal
layout
.
minimumInteritemSpacing
=
0
layout
.
minimumLineSpacing
=
0
let
collectionView
=
UICollectionView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
view
.
width
,
height
:
view
.
height
),
collectionViewLayout
:
layout
)
collectionView
.
isPagingEnabled
=
true
collectionView
.
delegate
=
self
collectionView
.
backgroundColor
=
.
white
collectionView
.
dataSource
=
self
collectionView
.
register
(
UINib
(
nibName
:
"TrashContenViewCell"
,
bundle
:
nil
),
forCellWithReuseIdentifier
:
"TrashContenViewCell0"
)
collectionView
.
register
(
UINib
(
nibName
:
"TrashContenViewCell"
,
bundle
:
nil
),
forCellWithReuseIdentifier
:
"TrashContenViewCell1"
)
collectionView
.
register
(
UINib
(
nibName
:
"TrashContenViewCell"
,
bundle
:
nil
),
forCellWithReuseIdentifier
:
"TrashContenViewCell2"
)
collectionView
.
register
(
UINib
(
nibName
:
"TrashContenViewCell"
,
bundle
:
nil
),
forCellWithReuseIdentifier
:
"TrashContenViewCell3"
)
return
collectionView
}()
//
// lazy var collectionView:UICollectionView = {
// let layout = UICollectionViewFlowLayout()
// layout.itemSize = CGSize(width: view.width, height: view.height)
// layout.scrollDirection = .horizontal
// layout.minimumInteritemSpacing = 0
// layout.minimumLineSpacing = 0
// let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: view.width, height: view.height), collectionViewLayout:layout)
// collectionView.isPagingEnabled = true
// collectionView.delegate = self
// collectionView.backgroundColor = .white
// collectionView.dataSource = self
// collectionView.register(UINib(nibName: "TrashContenViewCell", bundle: nil), forCellWithReuseIdentifier: "TrashContenViewCell0")
// collectionView.register(UINib(nibName: "TrashContenViewCell", bundle: nil), forCellWithReuseIdentifier: "TrashContenViewCell1")
// collectionView.register(UINib(nibName: "TrashContenViewCell", bundle: nil), forCellWithReuseIdentifier: "TrashContenViewCell2")
// collectionView.register(UINib(nibName: "TrashContenViewCell", bundle: nil), forCellWithReuseIdentifier: "TrashContenViewCell3")
//
// return collectionView
// }()
}
}
extension
TrashViewController
:
UICollectionViewDelegate
,
UICollectionViewDataSource
{
//extension TrashViewController:UICollectionViewDelegate,UICollectionViewDataSource{
//
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
// func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return
source
.
count
// return source.count
}
// }
//
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
// func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
"TrashContenViewCell
\(
indexPath
.
row
)
"
,
for
:
indexPath
)
as!
TrashContenViewCell
// let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "TrashContenViewCell\(indexPath.row)", for: indexPath) as! TrashContenViewCell
cell
.
trashType
=
source
[
indexPath
.
row
]
// cell.trashType = source[indexPath.row]
return
cell
// return cell
}
// }
//
//}
}
extension
TrashViewController
:
UIScrollViewDelegate
{
extension
TrashViewController
:
UIScrollViewDelegate
{
...
@@ -170,7 +171,4 @@ extension TrashViewController:UIScrollViewDelegate{
...
@@ -170,7 +171,4 @@ extension TrashViewController:UIScrollViewDelegate{
self
.
currentPage
=
currentPage
+
1
self
.
currentPage
=
currentPage
+
1
}
}
}
}
PhoneManager/Class/Page/Trash/View/TrashContenAssetCell.swift
View file @
21848fa1
...
@@ -21,8 +21,21 @@ class TrashContenAssetCell: UICollectionViewCell {
...
@@ -21,8 +21,21 @@ class TrashContenAssetCell: UICollectionViewCell {
assetImage
.
cornerCut
(
radius
:
8
,
corner
:
.
allCorners
)
assetImage
.
cornerCut
(
radius
:
8
,
corner
:
.
allCorners
)
}
}
var
model
:
AssetModel
?{
didSet
{
guard
let
model
=
model
else
{
return
}
}
// assetImage.im
}
@IBAction
func
removeClick
(
_
sender
:
Any
)
{
@IBAction
func
removeClick
(
_
sender
:
Any
)
{
}
}
}
}
PhoneManager/Class/Page/Trash/View/TrashContenView.swift
View file @
21848fa1
...
@@ -22,6 +22,8 @@ class TrashContenView: UIView {
...
@@ -22,6 +22,8 @@ class TrashContenView: UIView {
var
scrollLine
:
UIView
!
var
scrollLine
:
UIView
!
let
lineW
:
CGFloat
=
(
ScreenW
-
62
)
/
4.0
let
lineW
:
CGFloat
=
(
ScreenW
-
62
)
/
4.0
var
dataSource
:[
AssetModel
]
=
[]
override
init
(
frame
:
CGRect
)
{
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
super
.
init
(
frame
:
frame
)
backgroundColor
=
.
white
backgroundColor
=
.
white
...
@@ -32,6 +34,17 @@ class TrashContenView: UIView {
...
@@ -32,6 +34,17 @@ class TrashContenView: UIView {
fatalError
(
"init(coder:) has not been implemented"
)
fatalError
(
"init(coder:) has not been implemented"
)
}
}
func
getData
(){
// dataSource = TrashDatabase.shared.queryByMediaType(trashType.dbType).compactMap({ (localIdentifier: String, assetSize: Double, createDate: Date, mediaType: Int) in
// return AssetModel.init(localIdentifier: localIdentifier, assetSize: assetSize, createDate: createDate)
// })
collectionView
.
reloadData
()
}
func
configUI
(){
func
configUI
(){
let
layout
=
UICollectionViewFlowLayout
()
let
layout
=
UICollectionViewFlowLayout
()
layout
.
minimumInteritemSpacing
=
12
layout
.
minimumInteritemSpacing
=
12
...
@@ -223,7 +236,7 @@ class TrashContenView: UIView {
...
@@ -223,7 +236,7 @@ class TrashContenView: UIView {
case
.
chat
:
case
.
chat
:
scrollLine
.
frame
=
lineFour
.
frame
scrollLine
.
frame
=
lineFour
.
frame
}
}
collectionView
.
reload
Data
()
get
Data
()
}
}
}
}
}
}
...
@@ -236,24 +249,11 @@ extension TrashContenView:UICollectionViewDelegate,UICollectionViewDataSource,UI
...
@@ -236,24 +249,11 @@ extension TrashContenView:UICollectionViewDelegate,UICollectionViewDataSource,UI
}
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
return
20
//section == 0 ? 1 : 20
return
dataSource
.
count
}
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
// if indexPath.section == 0{
// let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "TrashContenTitleCell", for: indexPath) as! TrashContenTitleCell
// cell.trashType = trashType
// return cell
// }
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
"TrashContenAssetCell"
,
for
:
indexPath
)
as!
TrashContenAssetCell
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
"TrashContenAssetCell"
,
for
:
indexPath
)
as!
TrashContenAssetCell
return
cell
return
cell
}
}
// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize{
// return indexPath.section == 0 ? CGSize(width: ScreenW, height: 92) : CGSize(width: (ScreenW-56)/3, height: (ScreenW-56)/3)
// }
//
// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets{
// return section == 0 ? UIEdgeInsets() : UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 16)
// }
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment