How to use multiple protocols in Swift with same protocol variables?
The simple answer is that you can't.
Maybe one protocol depends on another, in which case you would use the dependent protocol for the type of your delegate.
How to create a Protocol in a Package without requiring Variables to be implemented Public?
You cannot do that.
If you make a type conform to a protocol, the conform will have the same access identifiers as the type itself. So if you make a public
type conform to a protocol, the protocol conformance will be public
as well.
In order for a type to conform to a protocol, all protocol requirements must be met. And if you are able to refer to a type as the protocol it conforms to, you must be able to access all protocol requirements as well.
So if you declare a type public
and make it conform to a protocol, you must declare all protocol requirements (both properties and methods) as public
.
This is by design and you cannot get around it.
Related Topics
Issues While Lightweight Core Data Migration
Abstract Class and Abstract Function in Swift
Swift - Nsurl Fileurlwithpath Not Unwrapped
Remove Cell When Button Pressed Inside Cell Customtableviewcell
How to Bind My Array Controller to My Core Data Model
How to Store Data from a Picker View in a Variable When a Button Is Pressed
Bleed Through from Nsbutton Checkbox on Non-Transparent Nspopover
Characteristic.Value from Bluetooth Reading in Swift
When Creating Thread Safe Reads in Swift, Why Is a Variable Create Outside The Concurrent Queue
Arkit: Plot a Node at a Specific Pixel at a Specific Z Distance from Camera
iOS - Could Not Open Obj File When Convert Mdlasset to Mdlmesh
Uipickerviewdelegate Xcode 8 Swift 3
Prevent Nscollectionview 'Lifting' an Item During Drag
Swift Framework with Opencv Dynamic Framework, Library Not Loaded
Understanding UIviewrepresentable
Allocating Ekeventstore Throws Warnings