make _dynamicContextEvaluation:patternString: public

Originator:michaelhochs
Number:rdar://29640794 Date Originated:13-Dec-2016 05:19 PM
Status:Open Resolved:
Product:iOS Product Version:10.1
Classification:Enhancement Reproducible:Always
 
Summary:
I just discovered NSFormattingContextDynamic today and was blown away by this feature. I started digging as I would love to see this working for custom formatters as well. I guess all it needs is a public API for the proxy that the system formatters return. A minimal version could even just make `_dynamicContextEvaluation:patternString:` publicly available. 

If that would be publicly available, this would bring a huge benefit for custom formatters.

Notes:
From playing around a bit with it, I guess the only pitfall with `_dynamicContextEvaluation:patternString:` is that currently `context` contains `pattern` multiple times when there are multiple placeholders in a string so it’s important to check for the first occurrence of `pattern` inside `context` when trying to determine the correct position. This could either be documented or changed by making `pattern` unique, e.g. by just adding a number at the end that increments. (So make it `%@NSCONTEXT1`, `%@NSCONTEXT2`,…)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!