• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Class in Swift
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Class in Swift


  • Subject: Re: Class in Swift
  • From: Marco S Hyman <email@hidden>
  • Date: Sat, 16 Aug 2014 16:56:47 -0700

On Aug 16, 2014, at 2:13 PM, Quincey Morris <email@hidden> wrote:

> Er, am I missing something, or is this not a case that generic functions handle quite easily?

That's what I thought, too.

protocol MyProtocol {
    init()
    // ...
}

func myFunction<T: MyProtocol>() {
//	for(...)  {
//          p = ...
//	    if ( p is special ) {
            	let aClass = T()
      	        // do something with aClass
//          }
//      }
}


There is a requirement that an init function must be part of the
protocol.

Marc
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Class in Swift (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Class in Swift (From: Charles Srstka <email@hidden>)
 >Re: Class in Swift (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Class in Swift
  • Next by Date: Preventing textfield in table from clicking default button
  • Previous by thread: Re: Class in Swift
  • Next by thread: Re: Class in Swift
  • Index(es):
    • Date
    • Thread