Re: [swift-evolution] [Pitch] Allow use associated type outside of its protocol

2017-02-19 Thread 曹剑楠 via swift-evolution
Thanks! Waiting for the new version. > 在 2017年2月20日,上午7:42,Xiaodi Wu 写道: > > That is a new feature in Swift 3.1. > > > On Sun, Feb 19, 2017 at 5:32 PM, 曹剑楠 > wrote: > Sorry about my typo: > > public struct Album { > public

Re: [swift-evolution] [Pitch] Allow use associated type outside of its protocol

2017-02-19 Thread Xiaodi Wu via swift-evolution
That is a new feature in Swift 3.1. On Sun, Feb 19, 2017 at 5:32 PM, 曹剑楠 wrote: > Sorry about my typo: > > public struct Album { >> public let sectionedMediaItemInfos: [Sectioned]?} >> >> >> public struct Sectioned : SectionProtocol { >> public let title: String? >>

Re: [swift-evolution] [Pitch] Allow use associated type outside of its protocol

2017-02-19 Thread 曹剑楠 via swift-evolution
Sorry about my typo: public struct Album { public let sectionedMediaItemInfos: [Sectioned]?} public struct Sectioned : SectionProtocol { public let title: String? public let items: [Item] public init() { items = [] title = nil } } public extension Array

Re: [swift-evolution] [Pitch] Allow use associated type outside of its protocol

2017-02-19 Thread 曹剑楠 via swift-evolution
OK, my fault. That solved the problem. > var items: [Element.SectionItemType] I should use this. How about to allow using generic type Section directly instead of declare a protocol ```Swift public extension Array where Element == Section { var itemsCount: Int { return

Re: [swift-evolution] [Pitch] Allow use associated type outside of its protocol

2017-02-19 Thread Xiaodi Wu via swift-evolution
On Sun, Feb 19, 2017 at 5:04 PM, 曹剑楠 via swift-evolution < swift-evolution@swift.org> wrote: > Hi All, > > I’m coding for section like data structure. > For example: > > I have an Album struct, which has many MediaItems. > It has a sectioned property called "sectionedMediaItemInfos", which is an

[swift-evolution] [Pitch] Allow use associated type outside of its protocol

2017-02-19 Thread 曹剑楠 via swift-evolution
Hi All, I’m coding for section like data structure. For example: I have an Album struct, which has many MediaItems. It has a sectioned property called "sectionedMediaItemInfos", which is an array of sections. Each section represents for a disc, and has an "items" array contains all MedaItems