From 813dc49c61179d7f9cea7b048fb9be6bb4b1d410 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Thu, 14 Apr 2022 11:41:44 -0400 Subject: [PATCH] feat: swift example --- .gitignore | 135 +++++++ Makefile | 10 +- .../swift-waku.xcodeproj/project.pbxproj | 362 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 93 +++++ .../swift-waku/Assets.xcassets/Contents.json | 6 + .../swift-waku/swift-waku/ContentView.swift | 22 ++ .../Preview Assets.xcassets/Contents.json | 6 + .../swift-waku/swift-waku/swift_wakuApp.swift | 17 + go.mod | 2 + go.sum | 4 +- library/api.go | 2 - library/api_relay.go | 9 +- 15 files changed, 683 insertions(+), 11 deletions(-) create mode 100644 examples/swift-waku/swift-waku.xcodeproj/project.pbxproj create mode 100644 examples/swift-waku/swift-waku.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 examples/swift-waku/swift-waku.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 examples/swift-waku/swift-waku/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 examples/swift-waku/swift-waku/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 examples/swift-waku/swift-waku/Assets.xcassets/Contents.json create mode 100644 examples/swift-waku/swift-waku/ContentView.swift create mode 100644 examples/swift-waku/swift-waku/Preview Content/Preview Assets.xcassets/Contents.json create mode 100644 examples/swift-waku/swift-waku/swift_wakuApp.swift diff --git a/.gitignore b/.gitignore index 9da01168..50bc140e 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,138 @@ coverage.json # Dependency directories (remove the comment below to include it) # vendor/ + +Gowaku.xcframework + + +# Created by https://www.toptal.com/developers/gitignore/api/swift,xcode,Cobjective-c,osx +# Edit at https://www.toptal.com/developers/gitignore?templates=swift,xcode,Cobjective-c,osx + +#!! ERROR: cobjective-c is undefined. Use list command to see defined gitignore types !!# + +### OSX ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Swift ### +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +build/ +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 + +## Obj-C/Swift specific +*.hmap + +## App packaging +*.ipa +*.dSYM.zip +*.dSYM + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +# Package.pins +# Package.resolved +# *.xcodeproj +# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata +# hence it is not needed unless you have added a package configuration file to your project +# .swiftpm + +.build/ + +# CocoaPods +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# Pods/ +# Add this line if you want to avoid checking in source code from the Xcode workspace +# *.xcworkspace + +# Carthage +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build/ + +# Accio dependency management +Dependencies/ +.accio/ + +# fastlane +# It is recommended to not store the screenshots in the git repo. +# Instead, use fastlane to re-generate the screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/#source-control + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots/**/*.png +fastlane/test_output + +# Code Injection +# After new code Injection tools there's a generated folder /iOSInjectionProject +# https://github.com/johnno1962/injectionforxcode + +iOSInjectionProject/ + +### Xcode ### + +## Xcode 8 and earlier + +### Xcode Patch ### +*.xcodeproj/* +!*.xcodeproj/project.pbxproj +!*.xcodeproj/xcshareddata/ +!*.xcworkspace/contents.xcworkspacedata +/*.gcno +**/xcshareddata/WorkspaceSettings.xcsettings + +# End of https://www.toptal.com/developers/gitignore/api/swift,xcode,Cobjective-c,osx \ No newline at end of file diff --git a/Makefile b/Makefile index 1d083296..2399bbce 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ CC_PREFIX := github.com/status-im/go-waku SHELL := bash # the shell used internally by Make -.PHONY: all build lint test coverage build-example static-library dynamic-library test-c test-c-template +.PHONY: all build lint test coverage build-example static-library dynamic-library test-c test-c-template mobile-android mobile-ios ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10... detected_OS := Windows @@ -121,4 +121,10 @@ mobile-android: gomobile init && \ gomobile bind -target=android -ldflags="-s -w" $(BUILD_FLAGS) -o ./build/lib/gowaku.aar ./mobile @echo "Android library built:" - @ls -la ./build/lib/*.aar ./build/lib/*.jar \ No newline at end of file + @ls -la ./build/lib/*.aar ./build/lib/*.jar + +mobile-ios: + gomobile init && \ + gomobile bind -target=ios -ldflags="-s -w" -o ./build/lib/Gowaku.xcframework ./mobile + @echo "IOS library built:" + @ls -la ./build/lib/*.xcframework \ No newline at end of file diff --git a/examples/swift-waku/swift-waku.xcodeproj/project.pbxproj b/examples/swift-waku/swift-waku.xcodeproj/project.pbxproj new file mode 100644 index 00000000..07dcae6b --- /dev/null +++ b/examples/swift-waku/swift-waku.xcodeproj/project.pbxproj @@ -0,0 +1,362 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 55; + objects = { + +/* Begin PBXBuildFile section */ + 791190E528047A5900A81D4A /* Gowaku.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 791190E328047A4500A81D4A /* Gowaku.xcframework */; }; + 798FB3D028046F7F00937EDF /* swift_wakuApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798FB3CF28046F7F00937EDF /* swift_wakuApp.swift */; }; + 798FB3D228046F7F00937EDF /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798FB3D128046F7F00937EDF /* ContentView.swift */; }; + 798FB3D428046F8200937EDF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 798FB3D328046F8200937EDF /* Assets.xcassets */; }; + 798FB3D728046F8200937EDF /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 798FB3D628046F8200937EDF /* Preview Assets.xcassets */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 791190E328047A4500A81D4A /* Gowaku.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = Gowaku.xcframework; sourceTree = ""; }; + 798FB3CC28046F7F00937EDF /* swift-waku.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "swift-waku.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 798FB3CF28046F7F00937EDF /* swift_wakuApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = swift_wakuApp.swift; sourceTree = ""; }; + 798FB3D128046F7F00937EDF /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 798FB3D328046F8200937EDF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 798FB3D628046F8200937EDF /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 798FB3C928046F7F00937EDF /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 791190E528047A5900A81D4A /* Gowaku.xcframework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 791190E2280479CB00A81D4A /* Frameworks */ = { + isa = PBXGroup; + children = ( + 791190E328047A4500A81D4A /* Gowaku.xcframework */, + ); + path = Frameworks; + sourceTree = ""; + }; + 798FB3C328046F7F00937EDF = { + isa = PBXGroup; + children = ( + 791190E2280479CB00A81D4A /* Frameworks */, + 798FB3CE28046F7F00937EDF /* swift-waku */, + 798FB3CD28046F7F00937EDF /* Products */, + ); + sourceTree = ""; + }; + 798FB3CD28046F7F00937EDF /* Products */ = { + isa = PBXGroup; + children = ( + 798FB3CC28046F7F00937EDF /* swift-waku.app */, + ); + name = Products; + sourceTree = ""; + }; + 798FB3CE28046F7F00937EDF /* swift-waku */ = { + isa = PBXGroup; + children = ( + 798FB3CF28046F7F00937EDF /* swift_wakuApp.swift */, + 798FB3D128046F7F00937EDF /* ContentView.swift */, + 798FB3D328046F8200937EDF /* Assets.xcassets */, + 798FB3D528046F8200937EDF /* Preview Content */, + ); + path = "swift-waku"; + sourceTree = ""; + }; + 798FB3D528046F8200937EDF /* Preview Content */ = { + isa = PBXGroup; + children = ( + 798FB3D628046F8200937EDF /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 798FB3CB28046F7F00937EDF /* swift-waku */ = { + isa = PBXNativeTarget; + buildConfigurationList = 798FB3DA28046F8200937EDF /* Build configuration list for PBXNativeTarget "swift-waku" */; + buildPhases = ( + 798FB3C828046F7F00937EDF /* Sources */, + 798FB3C928046F7F00937EDF /* Frameworks */, + 798FB3CA28046F7F00937EDF /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "swift-waku"; + productName = "swift-waku"; + productReference = 798FB3CC28046F7F00937EDF /* swift-waku.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 798FB3C428046F7F00937EDF /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1330; + LastUpgradeCheck = 1330; + TargetAttributes = { + 798FB3CB28046F7F00937EDF = { + CreatedOnToolsVersion = 13.3; + }; + }; + }; + buildConfigurationList = 798FB3C728046F7F00937EDF /* Build configuration list for PBXProject "swift-waku" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 798FB3C328046F7F00937EDF; + productRefGroup = 798FB3CD28046F7F00937EDF /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 798FB3CB28046F7F00937EDF /* swift-waku */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 798FB3CA28046F7F00937EDF /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 798FB3D728046F8200937EDF /* Preview Assets.xcassets in Resources */, + 798FB3D428046F8200937EDF /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 798FB3C828046F7F00937EDF /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 798FB3D228046F7F00937EDF /* ContentView.swift in Sources */, + 798FB3D028046F7F00937EDF /* swift_wakuApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 798FB3D828046F8200937EDF /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_BITCODE = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.4; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 798FB3D928046F8200937EDF /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_BITCODE = NO; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.4; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 798FB3DB28046F8200937EDF /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"swift-waku/Preview Content\""; + DEVELOPMENT_TEAM = 3VA3W764MV; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + "OTHER_CODE_SIGN_FLAGS[sdk=*]" = "--deep"; + PRODUCT_BUNDLE_IDENTIFIER = "status-im.swift-waku"; + PRODUCT_NAME = "$(TARGET_NAME)"; + STRIP_BITCODE_FROM_COPIED_FILES = NO; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 798FB3DC28046F8200937EDF /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"swift-waku/Preview Content\""; + DEVELOPMENT_TEAM = 3VA3W764MV; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + "OTHER_CODE_SIGN_FLAGS[sdk=*]" = "--deep"; + PRODUCT_BUNDLE_IDENTIFIER = "status-im.swift-waku"; + PRODUCT_NAME = "$(TARGET_NAME)"; + STRIP_BITCODE_FROM_COPIED_FILES = NO; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 798FB3C728046F7F00937EDF /* Build configuration list for PBXProject "swift-waku" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 798FB3D828046F8200937EDF /* Debug */, + 798FB3D928046F8200937EDF /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 798FB3DA28046F8200937EDF /* Build configuration list for PBXNativeTarget "swift-waku" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 798FB3DB28046F8200937EDF /* Debug */, + 798FB3DC28046F8200937EDF /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 798FB3C428046F7F00937EDF /* Project object */; +} diff --git a/examples/swift-waku/swift-waku.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/examples/swift-waku/swift-waku.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/examples/swift-waku/swift-waku.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/examples/swift-waku/swift-waku.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/examples/swift-waku/swift-waku.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/examples/swift-waku/swift-waku.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/examples/swift-waku/swift-waku/Assets.xcassets/AccentColor.colorset/Contents.json b/examples/swift-waku/swift-waku/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 00000000..eb878970 --- /dev/null +++ b/examples/swift-waku/swift-waku/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/examples/swift-waku/swift-waku/Assets.xcassets/AppIcon.appiconset/Contents.json b/examples/swift-waku/swift-waku/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..5a3257a7 --- /dev/null +++ b/examples/swift-waku/swift-waku/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,93 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/examples/swift-waku/swift-waku/Assets.xcassets/Contents.json b/examples/swift-waku/swift-waku/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/examples/swift-waku/swift-waku/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/examples/swift-waku/swift-waku/ContentView.swift b/examples/swift-waku/swift-waku/ContentView.swift new file mode 100644 index 00000000..dde3d892 --- /dev/null +++ b/examples/swift-waku/swift-waku/ContentView.swift @@ -0,0 +1,22 @@ +// +// ContentView.swift +// swift-waku +// +// Created by Richard Ramos on 11/4/22. +// + +import SwiftUI +import Gowaku + +struct ContentView: View { + var body: some View { + Text(GowakuDefaultPubsubTopic()) + .padding() + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} diff --git a/examples/swift-waku/swift-waku/Preview Content/Preview Assets.xcassets/Contents.json b/examples/swift-waku/swift-waku/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/examples/swift-waku/swift-waku/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/examples/swift-waku/swift-waku/swift_wakuApp.swift b/examples/swift-waku/swift-waku/swift_wakuApp.swift new file mode 100644 index 00000000..e3950b20 --- /dev/null +++ b/examples/swift-waku/swift-waku/swift_wakuApp.swift @@ -0,0 +1,17 @@ +// +// swift_wakuApp.swift +// swift-waku +// +// Created by Richard Ramos on 11/4/22. +// + +import SwiftUI + +@main +struct swift_wakuApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/go.mod b/go.mod index a4186685..904f0553 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module github.com/status-im/go-waku go 1.15 +replace github.com/raulk/go-watchdog v1.2.0 => github.com/status-im/go-watchdog v1.2.0-ios-nolibproc + require ( contrib.go.opencensus.io/exporter/prometheus v0.4.1 github.com/cruxic/go-hmac-drbg v0.0.0-20170206035330-84c46983886d diff --git a/go.sum b/go.sum index 4f138de7..93863047 100644 --- a/go.sum +++ b/go.sum @@ -909,8 +909,6 @@ github.com/prometheus/statsd_exporter v0.21.0/go.mod h1:rbT83sZq2V+p73lHhPZfMc3M github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/raulk/clock v1.1.0 h1:dpb29+UKMbLqiU/jqIJptgLR1nn23HLgMY0sTCDza5Y= github.com/raulk/clock v1.1.0/go.mod h1:3MpVxdZ/ODBQDxbN+kzshf5OSZwPjtMDx6BBXBmOeY0= -github.com/raulk/go-watchdog v1.2.0 h1:konN75pw2BMmZ+AfuAm5rtFsWcJpKF3m02rKituuXNo= -github.com/raulk/go-watchdog v1.2.0/go.mod h1:lzSbAl5sh4rtI8tYHU01BWIDzgzqaQLj6RcA1i4mlqI= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= @@ -983,6 +981,8 @@ github.com/status-im/go-discover v0.0.0-20220406135310-85a2ce36f63e h1:fDm8hqKGF github.com/status-im/go-discover v0.0.0-20220406135310-85a2ce36f63e/go.mod h1:u1s0ACIlweIjmJrgXyljRPSOflZLaS6ezb044+92W3c= github.com/status-im/go-waku-rendezvous v0.0.0-20211018070416-a93f3b70c432 h1:cbNFU38iimo9fY4B7CdF/fvIF6tNPJIZjBbpfmW2EY4= github.com/status-im/go-waku-rendezvous v0.0.0-20211018070416-a93f3b70c432/go.mod h1:A8t3i0CUGtXCA0aiLsP7iyikmk/KaD/2XVvNJqGCU20= +github.com/status-im/go-watchdog v1.2.0-ios-nolibproc h1:BJwZEF7OVKaXc2zErBUAolFSGzwrTBbWnN8e/6MER5E= +github.com/status-im/go-watchdog v1.2.0-ios-nolibproc/go.mod h1:lzSbAl5sh4rtI8tYHU01BWIDzgzqaQLj6RcA1i4mlqI= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= diff --git a/library/api.go b/library/api.go index 4c6f1ed7..afe2c1a7 100644 --- a/library/api.go +++ b/library/api.go @@ -27,8 +27,6 @@ func main() {} // - nodeKey: secp256k1 private key. Default random // - keepAliveInterval: interval in seconds to ping all peers // - relay: Enable WakuRelay. Default `true` -// This function will return a nodeID which should be used in all calls from this API that require -// interacting with the node. func waku_new(configJSON *C.char) *C.char { response := mobile.NewNode(C.GoString(configJSON)) return C.CString(response) diff --git a/library/api_relay.go b/library/api_relay.go index 36ef38bc..6894e86b 100644 --- a/library/api_relay.go +++ b/library/api_relay.go @@ -47,17 +47,16 @@ func waku_relay_publish_enc_symmetric(messageJSON *C.char, topic *C.char, symmet //export waku_relay_subscribe // Subscribe to a WakuRelay topic. Set the topic to NULL to subscribe -// to the default topic. Returns a json response containing the subscription ID -// or an error message. When a message is received, a "message" is emitted containing -// the message, pubsub topic, and nodeID in which the message was received +// to the default topic. Returns a json response. When a message is received, +// a "message" event is emitted containing the message and pubsub topic in which +// the message was received func waku_relay_subscribe(topic *C.char) *C.char { response := mobile.RelaySubscribe(C.GoString(topic)) return C.CString(response) } //export waku_relay_unsubscribe -// Closes the pubsub subscription to a pubsub topic. Existing subscriptions -// will not be closed, but they will stop receiving messages +// Closes the pubsub subscription to a pubsub topic func waku_relay_unsubscribe(topic *C.char) *C.char { response := mobile.RelayUnsubscribe(C.GoString(topic)) return C.CString(response)