Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark generated enums with @objc #3190

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions wire-runtime-swift/src/test/swift/sample/Period.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Source: squareup.geology.Period in squareup/geology/period.proto
import Wire

@objc
public enum Period : Int32, CaseIterable, Proto2Enum {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,7 @@ class SwiftGenerator private constructor(
val enumName = type.typeName
return TypeSpec.enumBuilder(enumName)
.addModifiers(PUBLIC)
.addAttribute("objc")
.addSuperTypes(listOf(INT32, CASE_ITERABLE, type.protoCodableType))
.apply {
type.protoDefaultedName?.let { protoDefaultedName ->
Expand Down
1 change: 1 addition & 0 deletions wire-tests-swift/manifest/module_one/SortOrder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Wire
/**
* Collides with Foundation.SortOrder
*/
@objc
public enum SortOrder : Int32, CaseIterable, Proto2Enum {

case DESC = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Source: squareup.protos.kotlin.swift_modules.SwiftModuleOneEnum in swift_module_one.proto
import Wire

@objc
public enum SwiftModuleOneEnum : Int32, CaseIterable, Proto2Enum {

case DO_NOT_USE = 0
Expand Down
1 change: 1 addition & 0 deletions wire-tests-swift/no-manifest/src/main/swift/AllTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ extension AllTypes : Codable {
*/
extension AllTypes {

@objc
public enum NestedEnum : Int32, CaseIterable, Proto2Enum {

case UNKNOWN = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Source: squareup.protos.kotlin.DeprecatedEnum in deprecated_enum.proto
import Wire

@objc
public enum DeprecatedEnum : Int32, CaseIterable, Proto2Enum {

@available(*, deprecated)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Source: squareup.protos.kotlin.unknownfields.EnumVersionOne in unknown_fields.proto
import Wire

@objc
public enum EnumVersionOne : Int32, CaseIterable, Proto2Enum {

case SHREK_V1 = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Source: squareup.protos.kotlin.unknownfields.EnumVersionTwo in unknown_fields.proto
import Wire

@objc
public enum EnumVersionTwo : Int32, CaseIterable, Proto2Enum {

case SHREK_V2 = 1
Expand Down
1 change: 1 addition & 0 deletions wire-tests-swift/no-manifest/src/main/swift/Error_.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Source: squareup.protos.kotlin.swift_modules.Error in swift_edge_cases.proto
import Wire

@objc
public enum Error_ : Int32, CaseIterable, Proto2Enum {

case UNKNOWN = 0
Expand Down
1 change: 1 addition & 0 deletions wire-tests-swift/no-manifest/src/main/swift/FooBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ extension FooBar {

}

@objc
public enum FooBarBazEnum : Int32, CaseIterable, Proto2Enum {

case FOO = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Source: squareup.protos.kotlin.foreign.ForeignEnum in foreign.proto
import Wire

@objc
public enum ForeignEnum : Int32, CaseIterable, Proto2Enum {

case BAV = 0
Expand Down
1 change: 1 addition & 0 deletions wire-tests-swift/no-manifest/src/main/swift/MappyTwo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ extension MappyTwo : Codable {
*/
extension MappyTwo {

@objc
public enum ValueEnum : Int32, CaseIterable, Proto2Enum {

case DEFAULT = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ extension MessageWithStatus : Codable {
*/
extension MessageWithStatus {

@objc
public enum Status : Int32, CaseIterable, Proto2Enum {

case A = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Source: squareup.protos.kotlin.NegativeValueEnum in negative_value_enum.proto
import Wire

@objc
public enum NegativeValueEnum : Int32, CaseIterable, Proto2Enum {

case DO_NOT_USE = -1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ extension OptionalEnumUser : Codable {
*/
extension OptionalEnumUser {

@objc
public enum OptionalEnum : Int32, CaseIterable, Proto2Enum {

case FOO = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ extension OtherMessageWithStatus : Codable {
*/
extension OtherMessageWithStatus {

@objc
public enum Status : Int32, CaseIterable, Proto2Enum {

case A = 1
Expand Down
1 change: 1 addition & 0 deletions wire-tests-swift/no-manifest/src/main/swift/Person.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ extension Person {
/**
* Represents the type of the phone number: mobile, home or work.
*/
@objc
public enum PhoneType : Int32, CaseIterable, Proto2Enum {

case MOBILE = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ extension SwiftEdgeCases : Codable {
*/
extension SwiftEdgeCases {

@objc
public enum Error_ : Int32, CaseIterable, Proto2Enum {

case UNKNOWN = 0
Expand All @@ -116,6 +117,7 @@ extension SwiftEdgeCases {

}

@objc
public enum Type_ : Int32, CaseIterable, Proto2Enum {

case INACTIVE = 0
Expand Down