You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In ChartViewBase.swift file, these is a snippet code like this:
/// returns the x-value at the given index
public func getXValue(index: Int) -> String!
{
if (_data == nil || _data.xValCount <= index)
{
return nil;
}
else
{
return _data.xVals[index];
}
}
I am not good at swift but I'm confused about the function's return type: String!, obviously, it may return nil.
I hope what I'm saying is clear enough...thx
The text was updated successfully, but these errors were encountered:
That question is suitable for a Swift forum, or Stackoverflow, or just reading the Swift manual by Apple!
But to make long story short, a String! is an optional String (nullable) that will unwrap automatically, avoiding the need to user the ? operator for reading its value.
In ChartViewBase.swift file, these is a snippet code like this:
/// returns the x-value at the given index
public func getXValue(index: Int) -> String!
{
if (_data == nil || _data.xValCount <= index)
{
return nil;
}
else
{
return _data.xVals[index];
}
}
I am not good at swift but I'm confused about the function's return type:
String!
, obviously, it may returnnil
.I hope what I'm saying is clear enough...thx
The text was updated successfully, but these errors were encountered: