Comments (2)
Ah yeah. So what happens is that when you make a Swift Package or framework, you need to implement your own init()
method. The default memberwise struct init isn't available — see this Stack Overflow question.
Thankfully, Xcode has a "Generate Memberwise Initializer" feature that auto-generates the default memberwise initializer. I've been using this, which is why you see the same values duplicated.
from setting.
Yes, I'm aware of that Xcode generation feature, if we have the same values in the initializers, would it make sense to remove the default values of the properties and only keep the ones in the memberwise initializers?
For example, someone (I don't know who), might be tempted to update the property value directly instead of updating the default argument value from the initializer.
What I have in my mind is :
public struct PreviewConfiguration {
public var icon: SettingIcon?
public var indicator: String
public var horizontalSpacing: CGFloat
public var verticalPadding: CGFloat
public var horizontalPadding: CGFloat
public init(
icon: SettingIcon? = nil,
indicator: String = "chevron.forward",
horizontalSpacing: CGFloat = CGFloat(12),
verticalPadding: CGFloat = CGFloat(14),
horizontalPadding: CGFloat = CGFloat(16)
) {
self.icon = icon
self.indicator = indicator
self.horizontalSpacing = horizontalSpacing
self.verticalPadding = verticalPadding
self.horizontalPadding = horizontalPadding
}
}
from setting.
Related Issues (20)
- Icon support for SettingButton HOT 1
- Navigate to UIKit HOT 1
- Search Bar in SettingPicker HOT 1
- Is it possible to enter multiline text? HOT 2
- compile error in SettingGroup file, line 91 HOT 6
- 'scrollDismissesKeyboard' is only available in macOS 13.0 or newer HOT 1
- Generic SettingView HOT 1
- Icon for SettingToggle HOT 2
- Is it possible to allow multiselection?
- Hiding search by default placement: .navigationBarDrawer(displayMode: .automatic))
- Position a custom settings view at the very bottom [i.e Logout Button]
- How to programatically display / jump to a specific Settings view within Settings?
- [BUG] navigation using NSHostingController within macOS app target does not allow for back nav
- Conditionals do not behave as expected
- Unable to use ForEach
- Example project cannot build HOT 1
- SettingPicker duplicates values
- Missing modifiers
- Unable to change Background Color for pushed SettingCustomView
- how can ı implement my async function SettingButton HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from setting.