Skip to content

Commit

Permalink
Replace #imageLiteral with UIImage(named: (#2248)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitschlag committed Jul 27, 2024
1 parent c1b78d9 commit 172ee52
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions deltachat-ios/Chat/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class ChatViewController: UITableViewController, UITableViewDropDelegate {
private lazy var muteItem: UIBarButtonItem = {
let imageView = UIImageView()
imageView.tintColor = DcColors.defaultTextColor
imageView.image = #imageLiteral(resourceName: "volume_off").withRenderingMode(.alwaysTemplate)
imageView.image = UIImage(named: "volume_off")?.withRenderingMode(.alwaysTemplate)
imageView.translatesAutoresizingMaskIntoConstraints = false
imageView.heightAnchor.constraint(equalToConstant: 20).isActive = true
imageView.widthAnchor.constraint(equalToConstant: 20).isActive = true
Expand All @@ -124,7 +124,7 @@ class ChatViewController: UITableViewController, UITableViewDropDelegate {
private lazy var ephemeralMessageItem: UIBarButtonItem = {
let imageView = UIImageView()
imageView.tintColor = DcColors.defaultTextColor
imageView.image = #imageLiteral(resourceName: "ephemeral_timer").withRenderingMode(.alwaysTemplate)
imageView.image = UIImage(named: "ephemeral_timer")?.withRenderingMode(.alwaysTemplate)
imageView.translatesAutoresizingMaskIntoConstraints = false
imageView.heightAnchor.constraint(equalToConstant: 20).isActive = true
imageView.widthAnchor.constraint(equalToConstant: 20).isActive = true
Expand Down Expand Up @@ -1230,7 +1230,7 @@ class ChatViewController: UITableViewController, UITableViewDropDelegate {
InputBarButtonItem()
.configure {
$0.spacing = .fixed(0)
let clipperIcon = #imageLiteral(resourceName: "ic_attach_file_36pt").withRenderingMode(.alwaysTemplate)
let clipperIcon = UIImage(named: "ic_attach_file_36pt")?.withRenderingMode(.alwaysTemplate)
$0.image = clipperIcon
$0.tintColor = DcColors.primary
$0.setSize(CGSize(width: 40, height: 40), animated: false)
Expand Down
2 changes: 1 addition & 1 deletion deltachat-ios/Chat/Views/Cells/VideoInviteCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class VideoInviteCell: UITableViewCell {
view.setColor(DcColors.systemMessageBackgroundColor)
view.translatesAutoresizingMaskIntoConstraints = false
view.setContentHuggingPriority(.defaultHigh, for: .horizontal)
view.setImage(#imageLiteral(resourceName: "ic_videochat").withRenderingMode(.alwaysTemplate))
view.setImage(UIImage(named: "ic_videochat")?.withRenderingMode(.alwaysTemplate))
view.tintColor = .white
view.imagePadding = 3
return view
Expand Down
2 changes: 1 addition & 1 deletion deltachat-ios/Chat/Views/DraftPreview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class DraftPreview: UIView {
private lazy var cancelImageView: UIImageView = {
let view = UIImageView(image: UIImage())
view.tintColor = .systemBlue
view.image = #imageLiteral(resourceName: "ic_close_36pt").withRenderingMode(.alwaysTemplate)
view.image = UIImage(named: "ic_close_36pt")?.withRenderingMode(.alwaysTemplate)
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()
Expand Down
8 changes: 4 additions & 4 deletions deltachat-ios/Chat/Views/StatusView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ public class StatusView: UIView {

switch Int32(state) {
case DC_DOWNLOAD_IN_PROGRESS, DC_STATE_OUT_PENDING, DC_STATE_OUT_PREPARING:
stateView.image = #imageLiteral(resourceName: "ic_hourglass_empty_white_36pt").maskWithColor(color: tintColor)
stateView.image = UIImage(named: "ic_hourglass_empty_white_36pt")?.maskWithColor(color: tintColor)
case DC_STATE_OUT_DELIVERED:
stateView.image = #imageLiteral(resourceName: "ic_done_36pt").maskWithColor(color: tintColor)
stateView.image = UIImage(named: "ic_done_36pt")?.maskWithColor(color: tintColor)
case DC_STATE_OUT_MDN_RCVD:
stateView.image = #imageLiteral(resourceName: "ic_done_all_36pt").maskWithColor(color: tintColor)
stateView.image = UIImage(named: "ic_done_all_36pt")?.maskWithColor(color: tintColor)
case DC_STATE_OUT_FAILED:
stateView.image = #imageLiteral(resourceName: "ic_error_36pt")
stateView.image = UIImage(named: "ic_error_36pt")
default:
stateView.image = nil
}
Expand Down
12 changes: 6 additions & 6 deletions deltachat-ios/View/ContactCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class ContactCell: UITableViewCell {
view.translatesAutoresizingMaskIntoConstraints = false
view.widthAnchor.constraint(equalToConstant: 16).isActive = true
view.tintColor = DcColors.middleGray
view.image = #imageLiteral(resourceName: "pinned_chatlist").withRenderingMode(.alwaysTemplate)
view.image = UIImage(named: "pinned_chatlist")?.withRenderingMode(.alwaysTemplate)
view.isHidden = true
view.contentMode = .scaleAspectFit
view.isAccessibilityElement = false
Expand All @@ -101,7 +101,7 @@ class ContactCell: UITableViewCell {
view.translatesAutoresizingMaskIntoConstraints = false
view.widthAnchor.constraint(equalToConstant: 16).isActive = true
view.tintColor = DcColors.middleGray
view.image = #imageLiteral(resourceName: "volume_off").withRenderingMode(.alwaysTemplate)
view.image = UIImage(named: "volume_off")?.withRenderingMode(.alwaysTemplate)
view.isHidden = true
view.contentMode = .scaleAspectFit
view.isAccessibilityElement = false
Expand Down Expand Up @@ -309,13 +309,13 @@ class ContactCell: UITableViewCell {
} else {
switch Int32(status) {
case DC_STATE_OUT_PENDING, DC_STATE_OUT_PREPARING:
deliveryStatusIndicator.image = #imageLiteral(resourceName: "ic_hourglass_empty_white_36pt").maskWithColor(color: DcColors.middleGray)
deliveryStatusIndicator.image = UIImage(named: "ic_hourglass_empty_white_36pt")?.maskWithColor(color: DcColors.middleGray)
case DC_STATE_OUT_DELIVERED:
deliveryStatusIndicator.image = #imageLiteral(resourceName: "ic_done_36pt")
deliveryStatusIndicator.image = UIImage(named: "ic_done_36pt")
case DC_STATE_OUT_FAILED:
deliveryStatusIndicator.image = #imageLiteral(resourceName: "ic_error_36pt")
deliveryStatusIndicator.image = UIImage(named: "ic_error_36pt")
case DC_STATE_OUT_MDN_RCVD:
deliveryStatusIndicator.image = #imageLiteral(resourceName: "ic_done_all_36pt")
deliveryStatusIndicator.image = UIImage(named: "ic_done_all_36pt")
default:
deliveryStatusIndicator.image = nil
}
Expand Down
2 changes: 1 addition & 1 deletion deltachat-ios/View/InitialsBadge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public class InitialsBadge: UIView {
label.font = font
}

public func setImage(_ image: UIImage) {
public func setImage(_ image: UIImage?) {
self.imageView.image = image
self.imageView.contentMode = UIView.ContentMode.scaleAspectFill
self.imageView.isHidden = false
Expand Down
2 changes: 1 addition & 1 deletion deltachat-ios/View/LocationStreamingIndicator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class LocationStreamingIndicator: UIImageView {

private func setup(size: CGFloat) {
tintColor = DcColors.checkmarkGreen
image = #imageLiteral(resourceName: "ic_location").withRenderingMode(.alwaysTemplate)
image = UIImage(named: "ic_location")?.withRenderingMode(.alwaysTemplate)
translatesAutoresizingMaskIntoConstraints = false
constraintHeightTo(size, priority: .defaultLow).isActive = true
constraintWidthTo(aspectRatio * size).isActive = true
Expand Down

0 comments on commit 172ee52

Please sign in to comment.