Skip to content

Commit

Permalink
Make swift types public
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebshr committed Nov 20, 2024
1 parent c672b87 commit a663966
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions src/Moat/Pretty/Swift.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ prettySwiftDataWith ::
prettySwiftDataWith indent = \case
MoatEnum {..} ->
prettyTypeDoc "" enumDoc []
++ "enum "
++ "public enum "
++ prettyMoatTypeHeader enumName (addTyVarBounds enumTyVars enumProtocols)
++ prettyRawValueAndProtocols enumRawValue enumProtocols
++ " {"
Expand All @@ -48,7 +48,7 @@ prettySwiftDataWith indent = \case
++ "}"
MoatStruct {..} ->
prettyTypeDoc "" structDoc []
++ "struct "
++ "public struct "
++ prettyMoatTypeHeader structName (addTyVarBounds structTyVars structProtocols)
++ prettyRawValueAndProtocols Nothing structProtocols
++ " {"
Expand All @@ -61,27 +61,27 @@ prettySwiftDataWith indent = \case
++ "}"
MoatAlias {..} ->
prettyTypeDoc "" aliasDoc []
++ "typealias "
++ "public typealias "
-- Swift aliases should not declare type parameters
++ prettyMoatTypeHeader aliasName []
++ " = "
++ prettyMoatTypeBase aliasTyp
MoatNewtype {..} ->
prettyTypeDoc "" newtypeDoc []
++ "struct "
++ "public struct "
++ prettyMoatTypeHeader newtypeName (addTyVarBounds newtypeTyVars newtypeProtocols)
++ prettyRawValueAndProtocols Nothing newtypeProtocols
++ " {\n"
++ indents
++ if isConcrete newtypeField
then
"let "
"public let "
++ fieldName newtypeField
++ ": "
++ prettyMoatType (fieldType newtypeField)
++ "\n}"
else
"typealias "
"public typealias "
++ newtypeName
++ "Tag"
++ " = Tagged<"
Expand Down Expand Up @@ -139,7 +139,7 @@ prettyTags indents = go
"\n"
++ prettyTagDisambiguator tagDisambiguate indents tagName
++ indents
++ "typealias "
++ "public typealias "
++ tagName
++ " = Tagged<"
++ (if tagDisambiguate then tagName ++ "Tag" else tagParent)
Expand All @@ -162,7 +162,7 @@ prettyTagDisambiguator disambiguate indents parent =
if disambiguate
then
indents
++ "enum "
++ "public enum "
++ parent
++ "Tag { }\n"
else ""
Expand Down Expand Up @@ -267,7 +267,7 @@ prettyStructFields indents fields deprecatedFields = go fields
deprecatedFieldsMap = Map.fromList deprecatedFields
prettyField (Field fieldName fieldType _fieldDoc) =
indents
++ "var "
++ "public var "
++ fieldName
++ ": "
++ prettyMoatType fieldType
Expand All @@ -288,7 +288,7 @@ prettyStructFields indents fields deprecatedFields = go fields
prettyNewtypeField :: String -> Field -> String -> String
prettyNewtypeField indents (Field alias fieldType _) fieldName =
indents
++ "let "
++ "public let "
++ alias
++ ": "
++ fieldName
Expand Down

0 comments on commit a663966

Please sign in to comment.