alexeyxo / protobuf-swift

Google ProtocolBuffers for Apple Swift
http://protobuf.io/#swift
Apache License 2.0
938 stars 138 forks source link

dynamic instance #175

Closed meysam-h closed 8 years ago

meysam-h commented 8 years ago

Version of protoc (protoc --version)

3.0

Version of ProtocolBuffers.framework

2.4.1

.proto file to reproduce

Description

i want to create object of my proto, with name and use its functions (dynamic instance), what can I do?!

alexeyxo commented 8 years ago

Example, please.

meysam-h commented 8 years ago

i want to do like this:

    let className = "myProjectName.Person"

    let aClass = NSClassFromString(className)

    let ClassBuild = aClass.Builder().build()

    ClassBuild.name = "Name"
alexeyxo commented 8 years ago

NSClassFromString - worked only with child of NSObject. You can use solutions with dynamicType.

ghost commented 6 years ago

Any solution on this ?