3 Replies
      Latest reply: Dec 22, 2016 4:41 PM by Gargoyle RSS
      Gargoyle Level 2 Level 2 (50 points)

        I'm trying to use UILocalizedIndexCollation's sector(for:collationStringSelector:) method. My 'for' is simply a String, and so I'm not sure what #selector() to pass in so that I just get the string itself back.

        • Re: selector to return string name
          eskimo Apple Staff Apple Staff (6,490 points)

          You want to use the Objective-C -self method.  Getting this is a bit tricky.  This will work:

          let s = "self"
          let section = col.section(for: "Foo", collationStringSelector: Selector(s))
          

          There might be a better way but I couldn’t find one that works and doesn’t generate any warnings.  Perhaps someone else will chime in.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

          • Re: selector to return string name
            KMT Level 8 Level 8 (7,700 points)

            What does that string represent (title?) & what will you do w/it once you get it back?

             

            It may be the method you've shown isn't your best friend...