我正在尝试使用
SwiftGtk
/home/luis/Dropbox/Documentos/Coding/Swift/SwiftGtk/.build/checkouts/SwiftGtk--2571330441700638662/Sources/HeaderBar.swift:15:63: error: value of type 'UnsafePointer<gchar>' (aka 'UnsafePointer<Int8>') has no member 'toString'
get { return gtk_header_bar_get_title(castedPointer())?.toString() }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ ~~~~~~~~
/home/luis/Dropbox/Documentos/Coding/Swift/SwiftGtk/.build/checkouts/SwiftGtk--2571330441700638662/Sources/HeaderBar.swift:20:66: error: value of type 'UnsafePointer<gchar>' (aka 'UnsafePointer<Int8>') has no member 'toString'
get { return gtk_header_bar_get_subtitle(castedPointer())?.toString() }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ ~~~~~~~~
/home/luis/Dropbox/Documentos/Coding/Swift/SwiftGtk/.build/checkouts/SwiftGtk--2571330441700638662/Sources/HeaderBar.swift:41:75: error: value of type 'UnsafePointer<gchar>' (aka 'UnsafePointer<Int8>') has no member 'toString'
get { return gtk_header_bar_get_decoration_layout(castedPointer())?.toString() }
似乎发生的是
Gtk.HeaderBar
get_title()方法返回gchar,它(我认为)属于UnsafePointer类型,在代码中未正确转换为字符串:
public var title: String? {
get { return gtk_header_bar_get_title(castedPointer())?.toString() }
set { gtk_header_bar_set_title(castedPointer(), newValue) }
}
public var subtitle: String? {
get { return gtk_header_bar_get_subtitle(castedPointer())?.toString() }
set { gtk_header_bar_set_subtitle(castedPointer(), newValue) }
}