Hi Enrico,
Thanks for your reply. This means, however, that I can’t easily distribute my 
code along with this synthetic child provider in a package or a library, 
correct?

> On 29 Jun 2016, at 19:16, Enrico Granata <egran...@apple.com> wrote:
> 
> Tim,
> the Xcode variables view is controlled by a different mechanism than the 
> playgrounds/po - there is a reference for that mechanism at 
> http://lldb.llvm.org/varformats.html <http://lldb.llvm.org/varformats.html>
> The gist of it is that you're going to want to make a synthetic child 
> provider that returns no child elements for your object - that will be what 
> the variables view picks up
> 
>> On Jun 26, 2016, at 9:41 PM, Dmitri Gribenko <griboz...@gmail.com 
>> <mailto:griboz...@gmail.com>> wrote:
>> 
>> On Sun, Jun 26, 2016 at 5:03 PM, Tim Vermeulen <tvermeu...@me.com 
>> <mailto:tvermeu...@me.com>> wrote:
>>> I already did that, sorry for not providing any code. Take this as an
>>> example:
>>> 
>>> public struct Wrapper<Element> {
>>> 
>>>    private var elements: [Element]
>>> 
>>>    public init<S: Sequence where S.Iterator.Element == Element>(_ sequence:
>>> S) {
>>>        elements = [Element](sequence)
>>>    }
>>> 
>>> }
>>> 
>>> extension Wrapper: Collection {
>>> 
>>>    public var startIndex: Int { return elements.startIndex }
>>>    public var endIndex: Int { return elements.endIndex }
>>> 
>>>    public func index(after index: Int) -> Int {
>>>        return index + 1
>>>    }
>>> 
>>>    public subscript(position: Int) -> Element {
>>>        return elements[position]
>>>    }
>>> 
>>> }
>>> 
>>> extension Wrapper: CustomReflectable {
>>> 
>>>    public var customMirror: Mirror {
>>>        return Mirror(self, unlabeledChildren: self, displayStyle:
>>> .collection)
>>>    }
>>> 
>>> }
>>> 
>>> If I debug an instance of this Wrapper type, then Xcode’s Variables View
>>> will show
>>> 
>>> ▿ wrapper
>>>  ▿ elements = x values
>>>    [0] = 0
>>>    [1] = …
>> 
>> I see.  I'm not sure there's a way to hide anything from Xcode's variables 
>> view.
>> 
>> +Enrico.
>> 
>> Dmitri
>> 
>> -- 
>> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
>> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <griboz...@gmail.com 
>> <mailto:griboz...@gmail.com>>*/
> 
> 
> Thanks,
> - Enrico
> 📩 egranata@.com ☎️ 27683
> 

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to