zmian / xcore Goto Github PK
View Code? Open in Web Editor NEWA collection of hundreds of Swift and SwiftUI extensions and components designed to minimize boilerplate to accomplish common tasks with ease.
License: MIT License
A collection of hundreds of Swift and SwiftUI extensions and components designed to minimize boilerplate to accomplish common tasks with ease.
License: MIT License
I ran into a really interesting edge case when I was trying to iterate on an objc enum using a protocol similar to your EnumIterable that freezed the app.
Here is the stack overflow comment and my sample project:
https://stackoverflow.com/questions/24007461/how-to-enumerate-an-enum-with-string-type/28341290#comment81415358_28341290
https://github.com/n8tr/IteratingEnumTestProject
LMK if you are interested in taking a look and have any ideas why this happens, or if there is a way we could make the compiler reject objc enums conforming to the protocol.
I hope all is well zmain!
Feel free to close this out if you don't want to be bothered. :)
๐
Hi @zmian
I've noticed that foregroundColor
shadows the native modifier:
func foregroundColor(_ color: UIColor) -> some View
func foregroundColor(_ color: Color?) -> some View
Now, when we have Xcore imported, the following uses the UIColor which IMHO is not desired:
Text("Text")
.foregroundColor(.red)
Is it possible to remove the shadowing?
E.g. rename the modifier like in here:
public func foregroundUIColor(_ uiColor: UIColor) -> some View
If that's not something you'd like to change feel free to close this ๐
Hi @zmian
I've noticed an ambiguity when using SwiftUI scaledEffect
with Xcore.
Because of CGSize conformance to ExpressibleByIntegerLiteral
and ExpressibleByFloatLiteral
as in here:
// MARK: - CGSize - ExpressibleByFloatLiteral
extension CGSize: ExpressibleByFloatLiteral {
public init(floatLiteral value: FloatLiteralType) {
let value = CGFloat(value)
self = CGSize(width: value, height: value)
}
}
// MARK: - CGSize - ExpressibleByIntegerLiteral
extension CGSize: ExpressibleByIntegerLiteral {
public init(integerLiteral value: IntegerLiteralType) {
let value = CGFloat(value)
self = CGSize(width: value, height: value)
}
}
there's an ambiguity between these SwiftUI modifiers:
@inlinable public func scaleEffect(_ s: CGFloat, anchor: UnitPoint = .center) -> some View
@inlinable public func scaleEffect(_ scale: CGSize, anchor: UnitPoint = .center) -> some View
Particularly when we try to apply scaledEffect
to a SwiftUI View:
Text("Xcore")
.scaleEffect(1.5) // Ambiguous use of 'scaleEffect(_:anchor:)'
Do you think you can solve this issue? My current solution simply removes both conformances but I'm sure this can be solved in a better way. Please let me know what you think.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.