chore: code format and add layer.cornerCurve = .continuous

This commit is contained in:
sunxiaojian 2021-04-13 13:06:35 +08:00
parent a59208a643
commit 7bf6328252
3 changed files with 9 additions and 5 deletions

View File

@ -33,6 +33,7 @@ class SearchRecommendAccountsCollectionViewCell: UICollectionViewCell {
let imageView = UIImageView()
imageView.contentMode = .scaleAspectFill
imageView.layer.cornerRadius = 10
imageView.layer.cornerCurve = .continuous
imageView.clipsToBounds = true
imageView.layer.borderWidth = 2
imageView.layer.borderColor = Asset.Colors.Border.searchCard.color.cgColor
@ -65,6 +66,7 @@ class SearchRecommendAccountsCollectionViewCell: UICollectionViewCell {
button.setTitle(L10n.Scene.Search.Recommend.Accounts.follow, for: .normal)
button.titleLabel?.font = .systemFont(ofSize: 14, weight: .semibold)
button.layer.cornerRadius = 12
button.layer.cornerCurve = .continuous
button.layer.borderWidth = 2
button.layer.borderColor = UIColor.white.cgColor
return button
@ -99,6 +101,7 @@ extension SearchRecommendAccountsCollectionViewCell {
private func configure() {
headerImageView.backgroundColor = Asset.Colors.brandBlue.color
layer.cornerRadius = 10
layer.cornerCurve = .continuous
clipsToBounds = false
applyShadow(color: Asset.Colors.Shadow.searchCard.color, alpha: 0.1, x: 0, y: 3, blur: 12, spread: 0)
contentView.addSubview(headerImageView)

View File

@ -68,6 +68,7 @@ extension SearchRecommendTagsCollectionViewCell {
private func configure() {
backgroundColor = Asset.Colors.brandBlue.color
layer.cornerRadius = 10
layer.cornerCurve = .continuous
clipsToBounds = false
layer.borderWidth = 2
layer.borderColor = Asset.Colors.Border.searchCard.color.cgColor

View File

@ -28,7 +28,7 @@ extension APIService.CoreData {
return nil
}
}()
if let oldTag = oldTag {
APIService.CoreData.merge(tag: oldTag, entity: entity, into: managedObjectContext)
return (oldTag, false)
@ -40,8 +40,8 @@ extension APIService.CoreData {
return (tagInCoreData, true)
}
}
static func merge(tag:Tag,entity:Mastodon.Entity.Tag,into managedObjectContext: NSManagedObjectContext) {
static func merge(tag: Tag, entity: Mastodon.Entity.Tag, into managedObjectContext: NSManagedObjectContext) {
tag.update(url: tag.url)
guard let tagHistories = tag.histories else { return }
guard let entityHistories = entity.history?.prefix(2) else { return }
@ -49,7 +49,7 @@ extension APIService.CoreData {
if entityHistoriesCount == 0 {
return
}
for n in 0..<tagHistories.count {
for n in 0 ..< tagHistories.count {
if n < entityHistories.count {
let entityHistory = entityHistories[n]
tag.updateHistory(index: n, day: entityHistory.day, uses: entityHistory.uses, account: entityHistory.accounts)
@ -58,7 +58,7 @@ extension APIService.CoreData {
if entityHistoriesCount <= tagHistories.count {
return
}
for n in 1...(entityHistoriesCount - tagHistories.count) {
for n in 1 ... (entityHistoriesCount - tagHistories.count) {
let entityHistory = entityHistories[entityHistoriesCount - n]
tag.appendHistory(history: History.insert(into: managedObjectContext, property: History.Property(day: entityHistory.day, uses: entityHistory.uses, accounts: entityHistory.accounts)))
}