Skip to content

Add legacy_uigraphics_functions rule#6269

Merged
SimplyDanny merged 1 commit intorealm:mainfrom
DimDL:legacy_uigraphics_functions
Apr 16, 2026
Merged

Add legacy_uigraphics_functions rule#6269
SimplyDanny merged 1 commit intorealm:mainfrom
DimDL:legacy_uigraphics_functions

Conversation

@DimDL
Copy link
Copy Markdown
Contributor

@DimDL DimDL commented Oct 1, 2025

Add new legacy_uigraphics_functions rule to encourage the use of modern UIGraphicsImageRenderer instead of legacy UIGraphics{Begin|End}ImageContext.

The modern replacement is safer, cleaner, Retina-aware and more performant.
The legacy API is deprecated

Resolves #6268

@SwiftLintBot
Copy link
Copy Markdown

SwiftLintBot commented Oct 1, 2025

191 Warnings
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/TestFavicons.swift:52:5: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/TestFavicons.swift:57:13: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/TestFavicons.swift:58:5: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/TestFavicons.swift:70:5: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/TestFavicons.swift:75:13: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/TestFavicons.swift:76:5: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Shared/Extensions/UIImageExtensions.swift:35:5: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Shared/Extensions/UIImageExtensions.swift:37:23: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Shared/Extensions/UIImageExtensions.swift:38:5: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Shared/Extensions/UIImageExtensions.swift:86:5: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Shared/Extensions/UIImageExtensions.swift:90:20: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Shared/Extensions/UIImageExtensions.swift:91:5: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Shared/Extensions/UIImageExtensions.swift:100:5: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Shared/Extensions/UIImageExtensions.swift:111:27: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Shared/Extensions/UIImageExtensions.swift:112:5: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/Extensions/UIViewExtensions.swift:21:5: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/Extensions/UIViewExtensions.swift:23:17: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/Extensions/UIViewExtensions.swift:24:5: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/Core/UIViewExtension.swift:81:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/Core/UIViewExtension.swift:84:21: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/Core/UIViewExtension.swift:85:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGoTests/StringExtensionTests.swift:197:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGoTests/StringExtensionTests.swift:200:21: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGoTests/StringExtensionTests.swift:201:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/UIComponents/Tests/UIComponentsTests/InlineImageTextTests.swift:376:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/UIComponents/Tests/UIComponentsTests/InlineImageTextTests.swift:379:21: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/UIComponents/Tests/UIComponentsTests/InlineImageTextTests.swift:380:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/UIComponents/Sources/UIComponents/iOS/FadeOutLabel.swift:58:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/UIComponents/Sources/UIComponents/iOS/FadeOutLabel.swift:68:29: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/UIComponents/Sources/UIComponents/iOS/FadeOutLabel.swift:69:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/CredentialProvider/Extensions/UIImageExtension.swift:9:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/CredentialProvider/Extensions/UIImageExtension.swift:10:17: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/CredentialProvider/Extensions/UIImageExtension.swift:13:16: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/Client/Frontend/Library/Downloads/DownloadsPanel.swift:196:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/Client/Frontend/Library/Downloads/DownloadsPanel.swift:223:21: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/Client/Frontend/Library/Downloads/DownloadsPanel.swift:224:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/Client/Extensions/UIView+Screenshot.swift:49:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/Client/Extensions/UIView+Screenshot.swift:59:21: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/Client/Extensions/UIView+Screenshot.swift:60:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/Client/Extensions/UIImage+Extension.swift:10:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/Client/Extensions/UIImage+Extension.swift:13:24: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/Client/Extensions/UIImage+Extension.swift:14:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/Client/Extensions/UIImage+Extension.swift:23:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/Client/Extensions/UIImage+Extension.swift:28:24: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/Client/Extensions/UIImage+Extension.swift:29:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /BrowserKit/Sources/SiteImageView/ImageProcessing/LetterImageGenerator.swift:54:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /BrowserKit/Sources/SiteImageView/ImageProcessing/LetterImageGenerator.swift:60:17: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /BrowserKit/Sources/SiteImageView/ImageProcessing/LetterImageGenerator.swift:61:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /BrowserKit/Sources/ToolbarKit/AddressToolbar/LocationView/LocationView.swift:808:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /BrowserKit/Sources/ToolbarKit/AddressToolbar/LocationView/LocationView.swift:813:24: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /BrowserKit/Sources/ToolbarKit/AddressToolbar/LocationView/LocationView.swift:814:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /focus-ios/BlockzillaPackage/Sources/UIHelpers/FaviIconGenerator.swift:25:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /focus-ios/BlockzillaPackage/Sources/UIHelpers/FaviIconGenerator.swift:27:13: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /focus-ios/BlockzillaPackage/Sources/UIHelpers/FaviIconGenerator.swift:31:21: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/firefox-ios-tests/Tests/StorageTests/DiskImageStoreTests.swift:66:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/firefox-ios-tests/Tests/StorageTests/DiskImageStoreTests.swift:69:21: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Firefox: /firefox-ios/firefox-ios-tests/Tests/StorageTests/DiskImageStoreTests.swift:70:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Kickstarter: /Kickstarter-Framework/Sources/Kickstarter-Framework/Kickstarter-iOS/Features/RootTabBar/RootTabBarViewController.swift:454:3: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Kickstarter: /Kickstarter-Framework/Sources/Kickstarter-Framework/Kickstarter-iOS/Features/RootTabBar/RootTabBarViewController.swift:455:11: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Kickstarter: /Kickstarter-Framework/Sources/Kickstarter-Framework/Kickstarter-iOS/Features/RootTabBar/RootTabBarViewController.swift:464:10: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Kickstarter: /Library/Sources/Library/Library/Image.swift:22:3: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Kickstarter: /Library/Sources/Library/Library/Image.swift:23:11: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Kickstarter: /Library/Sources/Library/Library/Image.swift:28:10: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Kickstarter: /Library/Sources/Library/Library/Image.swift:46:5: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Kickstarter: /Library/Sources/Library/Library/Image.swift:49:20: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Kickstarter: /Library/Sources/Library/Library/Image.swift:50:5: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Kickstarter: /Library/Sources/Library/Library/UIImage+Color.swift:5:5: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Kickstarter: /Library/Sources/Library/Library/UIImage+Color.swift:12:17: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Kickstarter: /Library/Sources/Library/Library/UIImage+Color.swift:13:5: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in NetNewsWire: /Modules/RSCore/Sources/RSCore/RSImage.swift:74:3: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in NetNewsWire: /Modules/RSCore/Sources/RSCore/RSImage.swift:77:22: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in NetNewsWire: /Modules/RSCore/Sources/RSCore/RSImage.swift:78:4: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in PocketCasts: /podcasts/Theme/Theme Specific Components/LenticularOverlayView.swift:13:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in PocketCasts: /podcasts/Theme/Theme Specific Components/LenticularOverlayView.swift:23:27: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in PocketCasts: /podcasts/Theme/Theme Specific Components/LenticularOverlayView.swift:24:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in PocketCasts: /Modules/Sources/PocketCastsUtils/Extensions/UI/UIImage+Tint.swift:6:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in PocketCasts: /Modules/Sources/PocketCastsUtils/Extensions/UI/UIImage+Tint.swift:23:28: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in PocketCasts: /Modules/Sources/PocketCastsUtils/Extensions/UI/UIImage+Tint.swift:24:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in PocketCasts: /Modules/Sources/PocketCastsUtils/Extensions/UI/UIImage+Tint.swift:51:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in PocketCasts: /Modules/Sources/PocketCastsUtils/Extensions/UI/UIImage+Tint.swift:52:17: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in PocketCasts: /Modules/Sources/PocketCastsUtils/Extensions/UI/UIImage+Tint.swift:55:16: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in VLC: /Sources/UI Elements/Sliders/VerticalSliderControl.swift:569:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in VLC: /Sources/UI Elements/Sliders/VerticalSliderControl.swift:578:19: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in VLC: /Sources/UI Elements/Sliders/VerticalSliderControl.swift:579:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in VLC: /Sources/Extensions/UIKit/UIImage+TintColor.swift:17:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in VLC: /Sources/Extensions/UIKit/UIImage+TintColor.swift:29:27: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in VLC: /Sources/Extensions/UIKit/UIImage+TintColor.swift:30:13: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in VLC: /Sources/Extensions/UIKit/UIImage+TintColor.swift:34:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in VLC: /Sources/Extensions/UIKit/UIImage+Gradient.swift:19:13: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in VLC: /Sources/Extensions/UIKit/UIImage+Gradient.swift:40:17: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in VLC: /Sources/Extensions/UIKit/UIImage+Gradient.swift:46:25: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in VLC: /Sources/Extensions/UIKit/UIImage+Gradient.swift:48:13: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Components/TokenField/TokenSeparatorAttachment.swift:78:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Components/TokenField/TokenSeparatorAttachment.swift:102:17: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Components/TokenField/TokenSeparatorAttachment.swift:105:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Components/TokenField/TokenTextAttachment.swift:63:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Components/TokenField/TokenTextAttachment.swift:80:17: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Components/TokenField/TokenTextAttachment.swift:83:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/UserInterface/Calling/CallGridView/RoundedPageIndicator.swift:92:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/UserInterface/Calling/CallGridView/RoundedPageIndicator.swift:109:21: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/UserInterface/Calling/CallGridView/RoundedPageIndicator.swift:110:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/UserInterface/Components/Views/Mentions/MentionsTextAttachment.swift:80:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/UserInterface/Components/Views/Mentions/MentionsTextAttachment.swift:83:21: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/UserInterface/Components/Views/Mentions/MentionsTextAttachment.swift:84:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Helpers/String+Image.swift:27:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Helpers/String+Image.swift:29:21: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Helpers/String+Image.swift:30:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Helpers/UIImage+ImageUtilities.swift:30:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Helpers/UIImage+ImageUtilities.swift:32:27: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Helpers/UIImage+ImageUtilities.swift:33:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Helpers/UIImage+ImageUtilities.swift:44:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Helpers/UIImage+ImageUtilities.swift:50:26: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Helpers/UIImage+ImageUtilities.swift:51:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Helpers/UIImage+ImageUtilities.swift:58:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Helpers/UIImage+ImageUtilities.swift:64:21: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Helpers/UIImage+ImageUtilities.swift:65:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Helpers/UIImage+ImageUtilities.swift:139:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Helpers/UIImage+ImageUtilities.swift:145:21: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/Wire-iOS/Sources/Helpers/UIImage+ImageUtilities.swift:146:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/WireCommonComponents/FilePreviewGenerator/PDFFilePreviewGenerator.swift:32:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/WireCommonComponents/FilePreviewGenerator/PDFFilePreviewGenerator.swift:33:17: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /wire-ios/WireCommonComponents/FilePreviewGenerator/PDFFilePreviewGenerator.swift:56:24: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /WireUI/Sources/WireDesign/Icons/Autogenerated/WireStyleKit.swift:7183:9: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ This PR introduced a violation in Wire: /WireUI/Sources/WireDesign/Icons/Autogenerated/WireStyleKit.swift:7186:33: Warning: Prefer using UIGraphicsImageRenderer over legacy functions (legacy_uigraphics_function)
⚠️ Danger found 191 violations with this PR. Due to GitHub's max issue comment size, the number shown has been truncated to 124.
19 Messages
📖 Building this branch resulted in a binary size of 27601.87 KiB vs 27574.71 KiB when built on main (0% larger).
📖 Linting Aerial with this PR took 0.82 s vs 0.81 s on main (1% slower).
📖 Linting Alamofire with this PR took 1.04 s vs 1.05 s on main (0% faster).
📖 Linting Brave with this PR took 7.38 s vs 7.44 s on main (0% faster).
📖 Linting DuckDuckGo with this PR took 28.49 s vs 28.56 s on main (0% faster).
📖 Linting Firefox with this PR took 12.32 s vs 12.34 s on main (0% faster).
📖 Linting Kickstarter with this PR took 8.49 s vs 8.56 s on main (0% faster).
📖 Linting Moya with this PR took 0.46 s vs 0.44 s on main (4% slower).
📖 Linting NetNewsWire with this PR took 2.58 s vs 2.66 s on main (3% faster).
📖 Linting Nimble with this PR took 0.63 s vs 0.71 s on main (11% faster).
📖 Linting PocketCasts with this PR took 7.78 s vs 7.94 s on main (2% faster).
📖 Linting Quick with this PR took 0.4 s vs 0.43 s on main (6% faster).
📖 Linting Realm with this PR took 2.97 s vs 3.05 s on main (2% faster).
📖 Linting Sourcery with this PR took 1.82 s vs 1.92 s on main (5% faster).
📖 Linting Swift with this PR took 4.69 s vs 4.81 s on main (2% faster).
📖 Linting SwiftLintPerformanceTests with this PR took 0.3 s vs 0.33 s on main (9% faster).
📖 Linting VLC with this PR took 1.19 s vs 1.27 s on main (6% faster).
📖 Linting Wire with this PR took 18.93 s vs 19.19 s on main (1% faster).
📖 Linting WordPress with this PR took 12.94 s vs 12.95 s on main (0% faster).

Generated by 🚫 Danger

Copy link
Copy Markdown
Collaborator

@SimplyDanny SimplyDanny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the prompt implementation of your issue!

Please consider my comments ... Have you checked whether the OSS findings reported in the bot comment make sense?

Comment thread CHANGELOG.md Outdated
Comment thread Source/SwiftLintBuiltInRules/Rules/Idiomatic/LegacyUIGraphicsFunctionsRule.swift Outdated
@SimplyDanny
Copy link
Copy Markdown
Collaborator

SimplyDanny commented Oct 2, 2025

I wasn't actually aware of LegacyFunctionRuleHelper. Can we make use of it for this rule as well?

Edit: I remove the helper in #6271 so that visitor and rewrite can directly be used.

@rgoldberg
Copy link
Copy Markdown

rgoldberg commented Apr 8, 2026

I have created an analyzer rule that reports all uses of any deprecated declarations (marked with @available), including soft deprecations, etc.

The types mentioned in this PR all seem like they should be detectable by my analyzer rule.

I used AI to create it, as I don't know SourceKitten, SourceKit, SwiftLint APIs, etc. I am cleaning up the code now, and will try to learn SourceKitten, etc. by reading the code.

Once it's cleaned up, would you review it? If so, I assume I should make a new issue for it (as I haven't found an existing one), and move this discussion to that issue.

Would it supersede this rule? What configuration options would you prefer? What names would you prefer be used? e.g., should it be the deprecated_uses rule, as it will report only uses of deprecated declarations, not deprecated declarations themselves?

I assume it would be helpful to filter out deprecated uses where the replacement is not available for the current project (e.g., based on the minimum supported platform versions), but I haven't determined if it's easy to obtain that info. If such filtering were provided, should the rule be able to read the minimum platform versions from a Package.swift? What about Package@….swift, where is a swift version? What about other build systems?

Should there be some way to globally ignore uses of specified declarations? If so, should they be specified via strings like "URL.init(fileURLWithPath:isDirectory:)"?

Should the rule try to detect the replacement declaration, and output its details in the violation message (I assume it will be too difficult to apply fixes via --fix).

Should the rule detect deprecated declarations via additional mechanisms? e.g., should it support manual replacement mappings (e.g., NSString.replacingOccurrences(of:with:) > RangeReplaceableCollection.replacing(_:with:maxReplacements:), as the former isn't marked with @available)?

Etc.

@SimplyDanny
Copy link
Copy Markdown
Collaborator

I have created an analyzer rule that reports all uses of any deprecated declarations (marked with @available), including soft deprecations, etc.

The types mentioned in this PR all seem like they should be detectable by my analyzer rule.

I used AI to create it, as I don't know SourceKitten, SourceKit, SwiftLint APIs, etc. I am cleaning up the code now, and will try to learn SourceKitten, etc. by reading the code.

Once it's cleaned up, would you review it? If so, I assume I should make a new issue for it (as I haven't found an existing one), and move this discussion to that issue.

Would it supersede this rule? What configuration options would you prefer? What names would you prefer be used? e.g., should it be the deprecated_uses rule, as it will report only uses of deprecated declarations, not deprecated declarations themselves?

I assume it would be helpful to filter out deprecated uses where the replacement is not available for the current project (e.g., based on the minimum supported platform versions), but I haven't determined if it's easy to obtain that info. If such filtering were provided, should the rule be able to read the minimum platform versions from a Package.swift? What about Package@….swift, where is a swift version? What about other build systems?

Should there be some way to globally ignore uses of specified declarations? If so, should they be specified via strings like "URL.init(fileURLWithPath:isDirectory:)"?

Should the rule try to detect the replacement declaration, and output its details in the violation message (I assume it will be too difficult to apply fixes via --fix).

Should the rule detect deprecated declarations via additional mechanisms? e.g., should it support manual replacement mappings (e.g., NSString.replacingOccurrences(of:with:) > RangeReplaceableCollection.replacing(_:with:maxReplacements:), as the former isn't marked with @available)?

Etc.

Both rules (and more existing ones) can live side by side. As Analyzer rules run very slow, the syntax-based rules are faster alternatives that might be sufficient for some/most users.

Let's chat about the other questions you have in the PR that you are about to create. A dedicated issue is not needed. 😉

@rgoldberg
Copy link
Copy Markdown

rgoldberg commented Apr 9, 2026

Will do. I will create a draft PR later today if you want to look over the code before I have a chance to completely understand SourceKit & ensure that the PR is up to snuff. I'll update the code & switch to a normal PR once I've had the chance to completely look through it all.

I'll also keep everything barebones to get feedback first, then add bells & whistles once everything has been discussed.

@rgoldberg
Copy link
Copy Markdown

FYI: the AI code was worse than I expected. I need to completely redo most of it, and to research beforehand. I will get back to it in a bit, then submit a PR once it's much better.

@SimplyDanny SimplyDanny force-pushed the legacy_uigraphics_functions branch from 90f71ca to 0f65858 Compare April 15, 2026 20:25
@SimplyDanny SimplyDanny force-pushed the legacy_uigraphics_functions branch from 0f65858 to 6105e44 Compare April 15, 2026 21:35
@SimplyDanny SimplyDanny enabled auto-merge (squash) April 15, 2026 21:35
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
@SimplyDanny SimplyDanny force-pushed the legacy_uigraphics_functions branch from 6105e44 to d0539eb Compare April 15, 2026 21:40
@SimplyDanny SimplyDanny merged commit 65f44a0 into realm:main Apr 16, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rule Request: "Legacy UIGraphics functions"

4 participants