Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default symbols are not enclosed via available attribute #14

Closed
itShouldWork opened this issue Jun 4, 2022 · 5 comments
Closed

Default symbols are not enclosed via available attribute #14

itShouldWork opened this issue Jun 4, 2022 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@itShouldWork
Copy link

Details

  • iOS Version: 13-14
  • Framework Version: 1.0.5
  • Installed via: Cocoapods

Describe the Bug

Default symbols (without any extensions) are not enclosed via available attribute. Thus there are a lot of cases where custom UIImage's initializer public convenience init(_ symbol: SPSafeSymbol) will crash app by force-unwrapping the system image that doesn't exists at current iOS.

For example: I want to display on iOS 13 a symbol named pills, that is available starting from iOS 14.

I can do this without any error:
let image = UIImage(.pills)

And if we look into the Pills (file SPSafeSymbol+Pills) extension we will see that pills doesn't enclose via available attribute.

extension SPSafeSymbol {

	public static var pills: Pills { .init(name: "pills") }

	open class Pills: SPSafeSymbol {

		@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
		open var circle: SPSafeSymbol { ext(.start.circle) }
		@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
		open var circleFill: SPSafeSymbol { ext(.start.circle.fill) }

		@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
		open var fill: SPSafeSymbol { ext(.start.fill) }
	}
}
@itShouldWork itShouldWork added the bug Something isn't working label Jun 4, 2022
@ivanvorobei
Copy link
Member

Thanks for report, I am start fixing it

@ivanvorobei
Copy link
Member

Fixed in 1.1.2.

@Banck
Copy link

Banck commented Jun 14, 2022

Fixed in 1.1.2.

Hey!
Seems you have set the wrong accessibility. For example:
.photo - @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *), but it available in iOS 13+
.trash - @available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *) but it available in iOS 13+
.tray.andArrowDownFill -
image
And more others, which have the top level @available iOS 15 and therefore the properties of the class cannot be accessed

@ivanvorobei ivanvorobei reopened this Jun 14, 2022
@ivanvorobei
Copy link
Member

@Banck thanks, checking it now

@ivanvorobei
Copy link
Member

Fixed in 1.1.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants