I download ServiceStack Swift Plugin and installed.
but no plugin menu show in Xcode.
xcode version is 9.2 with swift 4.
Apple disabled plugins in XCode 8 so it’s no longer possible to install our extension.
You’ll need to generate Swift DTOs using swift-ref command-line tool.
Thank you.
another problem.
I have a dto like
public abstract class BaseDto
{
public int Total{get;set;}
}
public class LogOn:BaseDto
{
...
}
and changed dto.swift file like this
/
* Options:
Date: 2018-01-10 23:57:20
SwiftVersion: 3.0
Version: 5.00
Tip: To override a DTO option, remove "//" prefix before updating
BaseUrl: ...
BaseClass: NSObject
//AddModelExtensions: True
//AddServiceStackTypes: True
//IncludeTypes:
//ExcludeTypes:
//ExcludeGenericBaseTypes: False
//AddResponseStatus: False
//AddImplicitVersion:
//AddDescriptionAsComments: True
//InitializeCollections: True
//TreatTypesAsStrings:
//DefaultImports: Foundation
*/
then class LogOn like this
public class LogOn : BaseDto
{
required public init(){}
public var loginId:String?
public var loginPwd:String?
}
extension LogOn : JsonSerializable
{
public static var typeName:String { return "LogOn" }
public static var metadata = Metadata.create([
Type<LogOn>.optionalProperty("loginId", get: { $0.loginId }, set: { $0.loginId = $1 }),
Type<LogOn>.optionalProperty("loginPwd", get: { $0.loginPwd }, set: { $0.loginPwd = $1 }),
Type<LogOn>.optionalProperty("schoolId", get: { $0.schoolId }, set: { $0.schoolId = $1 }),
Type<LogOn>.optionalProperty("skip", get: { $0.skip }, set: { $0.skip = $1 }),
Type<LogOn>.optionalProperty("take", get: { $0.take }, set: { $0.take = $1 }),
])
}
when I use client.post(LogOn()) error happens
I need make some change on class LogOn
public class LogOn : NSObject,IReturn
{
required public override init(){}
public typealias Return = ClassResponse
public var loginId:String?
public var loginPwd:String?
}
should I need write dtos only for ios? or something I can do with settings?
You need to annotate your Request DTOs with the IReturn<T>
marker, e.g:
public class LogOn : IReturn<ClassResponse>
{
...
}