私たちはすばやいライブラリを持っており、Objective-Cベースのプロジェクトで使用しています。目的のCヘッダーファイルで素早く弱いです
弱いfileprivateするvar _axisValueFormatter:IAxisValueFormatter
/// Base class for all axes @objc(ChartAxisBase) open class AxisBase: ComponentBase { public override init() { super.init() } /// Custom formatter that is used instead of the auto-formatter if set weak fileprivate var _axisValueFormatter: IAxisValueFormatter? /// Sets the formatter to be used for formatting the axis labels. /// If no formatter is set, the chart will automatically determine a reasonable formatting (concerning decimals) for all the values that are drawn inside the chart. /// Use `nil` to use the formatter calculated by the chart. open var valueFormatter: IAxisValueFormatter? { get { if _axisValueFormatter == nil || (_axisValueFormatter is DefaultAxisValueFormatter && (_axisValueFormatter as! DefaultAxisValueFormatter).hasAutoDecimals && (_axisValueFormatter as! DefaultAxisValueFormatter).decimals != decimals) { let df = DefaultAxisValueFormatter(decimals: decimals) _axisValueFormatter = df NSLog("found nil vf, assigning to \(_axisValueFormatter)") } NSLog("returning \(_axisValueFormatter)") return _axisValueFormatter } set { _axisValueFormatter = newValue //?? DefaultAxisValueFormatter(decimals: decimals) } } ... }
ご覧のとおり、プライベートvarがあり、弱いように宣言:迅速で
は、このようなクラスがありますか?
valueFormatter
のゲッターとセッターがあります。
しかし、等valueFormatter
ためのObjective-Cヘッダ生成する最新のXcode 8.2.1:
@property(非アトミック、強い)ID _Nullable valueFormatterと、
ご覧のとおり、強く、ヘッダファイルにも_axisValueFormatter
が見つかります。
これは予想されますか?どうすればそれを正しくすることができますか?前もって感謝します。
その後、 '_axisValueFormatter'は迅速に弱く、どのようにObjective-Cのでは? openプロパティのaxisValueFormatterは強いようですが、基になる '_axisValueFormatter'は弱いです。客観的に弱い性質のように働くか? – Wingzero
@Wingzero私の答えが – Andy
に更新されました。値のプロパティvalueFormatterにweakを指定すると、ちょっと混乱します。私は_axisValueFormatterを弱く宣言すれば、何が起こるのですか? – Wingzero