-
Notifications
You must be signed in to change notification settings - Fork 976
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1561 from stripe-ios/kg-tintconsent
Financial Connections: started client-side-tinting Consent and Data Access View icons.
- Loading branch information
Showing
4 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...Connections/StripeFinancialConnections/Source/Native/Shared/AlwaysTemplateImageView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// AlwaysTemplateImageView.swift | ||
// StripeFinancialConnections | ||
// | ||
// Created by Krisjanis Gaidis on 11/1/22. | ||
// Copyright © 2022 Stripe, Inc. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
// A simple `UIImageView` subclass that ensures that every image that | ||
// is set is marked as `alwaysTemplate` so the `image` tint color could | ||
// be adjusted. | ||
// | ||
// This is helpful when images are returned from backend and we want to tint them. | ||
final class AlwaysTemplateImageView: UIImageView { | ||
|
||
init(tintColor: UIColor) { | ||
super.init(image: nil) | ||
self.tintColor = tintColor | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
override var image: UIImage? { | ||
set { | ||
super.image = newValue?.withRenderingMode(.alwaysTemplate) | ||
} | ||
get { | ||
return super.image | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters