GithubHelp home page GithubHelp logo

gomatcha / matcha Goto Github PK

View Code? Open in Web Editor NEW
3.5K 85.0 161.0 7.84 MB

Build native mobile apps in Go.

Home Page: https://gomatcha.io/

License: Apache License 2.0

Go 49.52% Objective-C 23.54% C 3.65% Java 23.14% C++ 0.15%

matcha's Introduction

Matcha - iOS and Android apps in Go

gomatcha.io

Matcha is in early development! There are many rough edges and APIs may still change. Please file issues for any bugs you find.

What is Matcha?

Matcha is a package for building iOS and Android applications and frameworks in Go. Matcha provides a UI component library similar to ReactNative and exposes bindings to Objective-C and Java code through reflection. The library also provides Go APIs for common app tasks.

Examples

settings-example insta-example todo-example

Installation - macOS

Matcha requires the following components to be installed.

  • Go 1.8+
  • Xcode 8.3+
  • Android Studio 2.3+ (with SDK 26, NDK and Android Support)

Start by installing Xcode and Android Studio. Instructions can be found at https://developer.apple.com/download/ and https://developer.android.com/studio/install.html.

You may need to run the following before starting Android Studio to allow it to read your GOPATH (https://stackoverflow.com/a/14285335). This also must be done on reboot.

launchctl setenv GOPATH $GOPATH

Open Android Studio's SDK Manager and under the SDK Platforms tab, install the Android 8 Platform (API 26). And in the SDK Tools tab, install NDK and the Android Support Repository.

Configure the ANDROID_HOME enviromental variable to point to the Android SDK by adding the following to your ~/.bash_profile. The Android SDK is often located at ~/Library/Android/sdk depending on your install.

export ANDROID_HOME=<SDK location>

Fetch the project and install the matcha command.

go get gomatcha.io/matcha/...

Next we build the Go standard library for iOS and Android with the following command. The output is installed at $GOPATH/pkg/matcha. If your path doesn't contain $GOPATH/bin, you may need to replace these calls with $GOPATH/bin/matcha.

matcha init

Now build the example project. The output is installed at $GOPATH/src/gomatcha.io/matcha/ios/MatchaBridge/MatchaBridge/MatchaBridge.a and $GOPATH/src/gomatcha.io/matcha/android/matchabridge.aar.

matcha build gomatcha.io/matcha/examples

We can now open the sample iOS project.

open $GOPATH/src/gomatcha.io/matcha/examples/ios-app/SampleApp.xcworkspace

Set the Development Team in Xcode under General > Signing and select SampleApp in the target dropdown in the upper right. Then run the App!

For Android, simply open the sample Android Studio project and hit run!

open -a /Applications/Android\ Studio.app $GOPATH/src/gomatcha.io/matcha/examples/android-app/SampleApp

Installation - Linux

Matcha requires the following components to be installed. iOS builds are not supported on Linux.

  • Go 1.8+
  • Android Studio 2.3+ (with SDK 26, NDK and Android Support Library)

Start by installing Android Studio. Instructions can be found at https://developer.android.com/studio/install.html.

Open Android Studio's SDK Manager and under the SDK Platforms tab, install the Android 8 Platform (API 26). And in the SDK Tools tab, install NDK and the Android Support Repository.

Configure the ANDROID_HOME enviromental variable to point to the Android SDK by adding the following to your ~/.bash_profile. The Android SDK is often located at ~/Android/Sdk depending on your install.

export ANDROID_HOME=<SDK location>

Additionally add the following to your ~/.bash_profile to modify your PATH to include the Java compiler if it does not already. javac can often be found at /usr/local/android-studio/jre/bin.

export PATH=${PATH}:<Java Compiler location>

Fetch the project and install the matcha command.

go get gomatcha.io/matcha/...

Next we build the Go standard library for Android with the following command. The output is installed at $GOPATH/pkg/matcha. If your path doesn't contain $GOPATH/bin, you may need to replace these calls with $GOPATH/bin/matcha.

matcha init

Now build the example project. The output is installed at $GOPATH/src/gomatcha.io/matcha/android/matchabridge.aar.

matcha build gomatcha.io/matcha/examples

Now open the sample Android Studio project and hit run!

<Android Studio location>/bin/studio.sh $GOPATH/src/gomatcha.io/matcha/examples/android-app/SampleApp

Installation - Windows

Matcha requires the following components to be installed. iOS builds are not supported on Windows.

  • Go 1.8+
  • Android Studio 2.3+ (with SDK 26, NDK and Android Support Library)

Start by installing Android Studio. Instructions can be found at https://developer.android.com/studio/install.html.

Open Android Studio's SDK Manager and under the SDK Platforms tab, install the Android 8 Platform (API 26). And in the SDK Tools tab, install NDK and the Android Support Repository.

Configure the ANDROID_HOME enviromental variable to point to the Android SDK. The Android SDK is often located at %USERPROFILE%\AppData\Local\Android\Sdk depending on your install.

setx ANDROID_HOME <SDK location>

Modify your PATH to include the Java compiler if it does not already. javac can often be found at C:\Program Files\Android\Android Studio\jre\bin.

setx PATH %PATH%;<Java Compiler location>

Fetch the project and install the matcha command.

go get gomatcha.io/matcha/...

Next we build the Go standard library for Android with the following command. The output is installed at $GOPATH/pkg/matcha. If your path doesn't contain $GOPATH/bin, you may need to replace these calls with $GOPATH/bin/matcha.

matcha init

Now build the example project. The output is installed at $GOPATH/src/gomatcha.io/matcha/android/matchabridge.aar.

matcha build gomatcha.io/matcha/examples

Now open the sample Android Studio project and hit run!

Try it out!

Contact us

matcha's People

Contributors

omar-elrefaei avatar overcyn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

matcha's Issues

unable to place configurable product order in magneto 2.1.8

Am not able to place order on checkout page for configurable products in Magento 2.1.8.Its working perfect for simple products.At the same time i noticed that the quantity of configurable item showing as zero even i change it.please help me to fix it.

Support for XCode 9.0

When trying to run matcha init it shows:

$ matcha init
xcrun --show-sdk-path: exit status 1

Manually running xcrun --show-sdk-path yields no output.

I have installed protobuf and I have XCode 9.0 in the system. Should I downgrade or support for 9.0 is near in the roadmap?

Great work! But -:) Tutorial need update

Thanks for the great tool! It would be very useful to use golang to build a quick apps.

I notice the tutorial code is outdated and can not build. So I just update and submit one PR overcyn/tutorial#1 . Unfortunately it still can not run on ios. I'm not ios app expert, can someone please take a look at it? I'm eagerly to try this tool asap. :-)

Use too much CPU

my little app used about 12% CPU.
i found call for go-go.go:matchaGoCall very often even no operation on app.

OS Notifications

Would be great if this was exposed at the golang layer to make local notifications to the OS.

I guess also being able to respond to notifications sent via the Google and Apple notification servers, where the user sees the notification and then clicks on it and it routes into your app.

Android SampleApp gradle sync failed

With Android Studio 2.3.3 and 3.0.0

Project :app declares a dependency from configuration 'compile' to configuration 'default' which is not declared in the descriptor for project :matcha.

gradlew build works.

ubuntu no xcode

kelvin@gnux:~/gocode/src/ah> matcha init (10/16 20:15:11)
Xcode not available

go get doesn t seem to work

gomatcha.io is down therefore the go get doesn t work.
go get gomatcha.io/matcha/...
package gomatcha.io/matcha/...: unrecognized import path "gomatcha.io/matcha/..." (https fetch: Get https://gomatcha.io/matcha?go-get=1: dial tcp 35.185.207.120:443: i/o timeout)

Tried
go get github.com/gomatcha/matcha
package gomatcha.io/matcha/bridge: unrecognized import path "gomatcha.io/matcha/bridge" (https fetch: Get https://gomatcha.io/matcha/bridge?go-get=1: dial tcp 35.185.207.120:443: i/o timeout)

Please update the readme with the current methode to go get the project.

matcha init failed : exit status 2

When i excute init command on Mac OS , it's always failed with output below .

go install -pkgdir=~/go/pkg/matcha/pkg_darwin_arm std failed: exit status 2

os/exec
/usr/local/go/src/os/exec/lp_unix.go:57:39: too many values in struct initializer

webviews

Because all all the plumbing you have it will be pretty easy to also expose a webview ?

I only suggest this because at the moment, you have access to native types for GUI's and thats great, but there are also times when you want to just code use web and have it run on all mobiles with an agnostic GUI.

I have been following this project for ages and i like the way the protobufs are used. Its really the first approach that i feel is sustainable for golang GUI's

android/386 android/amd64

Hi. Please tell why they removed these lines from the file?
I could not find the answer to this question? sorry if already answered it.
in matcha/cmd/bind.go

//targets["android/386"] = struct{}{}
//targets["android/amd64"] = struct{}{}

go get failing...

did not try to work out whats broken..

x-MacBook-Pro:~ apple$ go get gomatcha.io/matcha/...
# github.com/overcyn/customview
workspace/go/src/github.com/overcyn/customview/customview.go:16: ctx.Prev undefined (type *"gomatcha.io/matcha/view".Context has no field or method Prev)
workspace/go/src/github.com/overcyn/customview/customview.go:20: ctx.NewEmbed undefined (type *"gomatcha.io/matcha/view".Context has no field or method NewEmbed)

Is the matcha project still active?

I am looking for a GUI go mobile cross platform framework to support IOS and android mobile app development with GO, I checked this matcha project, and found this project has no updates for 9 months, is this matcha project still active? any recommendations? it seems not many candidates for my purpose.

Thanks
IDoor

android sync fail for example SampleApp

Error:A problem occurred configuring project ':app'.

Could not resolve all dependencies for configuration ':app:_debugApk'.
Project :app declares a dependency from configuration 'compile' to configuration 'default' which is not declared in the descriptor for project :matcha.

Can anyone help?

singing ios example

in xcode the bundle ID needs to be changed ?

In Xcode GUI under General > Signing i have:

Failed to create provisioning profile.
The app ID "io.gomatcha.SampleApp" cannot be registered to your development team. Change your bundle identifier to a unique string to try again.

Matcha init error

Getting this error when trying to run "matcha init"
image
xcrun --show-sdk-path: exit status 1

Questions about dependencies

Hello, I am following the page at https://gomatcha.io/guide/installation/ which asks for these packages to be installed:

Go 1.8
Xcode 8.3
Android Studio 2.3
NDK
Protobuf 3.3 - ObjC and Java

I am confused about how to handle the Protobuf 3.3 packages. After googling Protobuf I discovered that there are separate .zip file downloads for Objective C and Java. I duly downloaded these zip files but it is not clear how to install them or how to proceed.

A folder comparison utility reveals that the 2 zip files are probably 98% identical - surely they are not intended to be installed separately!

I appreciate that you are not responsible for the installation of other packages, but where those packages are so poorly documented, it would be useful to have some clue offered.

The NDK package was a struggle to install as well. I eventually found a page with, as it transpired, out of date instructions which told me to use homebrew to install NDK. After posting a question to Homebrew's forum I got an answer which let me proceed.

To recap, then, how do I install Protobuf 3.3, so that I can actually start using Matcha?

android and ios working really well, but IOS is only running Protocol buffers test harness

On Android it shows the samples.
But on IOS, it only shows the Protobuf example..

Still trying to work out where to change the code to point to different sample.
Is this correct ?
open $(APP01_FILE_PATH)/ios-app/SampleApp/SampleApp/AppDelegate.m
open $(APP01_FILE_PATH)/android-app/SampleApp/app/src/main/java/io/gomatcha/sampleapp/MainActivity.java

Anyway here is how i kick off the samples:

DIR=$(PWD)

LIB_GO_PATH=gomatcha.io/matcha
LIB_FILE_PATH=$(GOPATH)/src/$(LIB_GO_PATH)


APP01_GO_PATH=gomatcha.io/matcha/examples
APP01_FILE_PATH=$(GOPATH)/src/$(APP01_GO_PATH)


build-change:
	open $(APP01_FILE_PATH)/ios-app/SampleApp/SampleApp/AppDelegate.m

build-ios:

	# build their examples
	matcha build $(APP01_GO_PATH)

	# open ex 01
	open $(APP01_FILE_PATH)/ios-app/SampleApp.xcworkspace

	# Set the Development Team in Xcode under General > Signing and select SampleApp in the target dropdown in the upper right. Then run the App!

	
build-android:

	matcha build $(APP01_GO_PATH)

	open -a /Applications/Android\ Studio.app $(APP01_FILE_PATH)/android-app/SampleApp

screen shot 2017-10-13 at 16 07 23

No such function: github.com/xxxxx/application NewOrientationView

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    //gomatcha.io/matcha/examples NewExamplesView
    //gomatcha.io/matcha/examples/application
    MatchaGoValue *view = [[[MatchaGoValue alloc] initWithFunc:@"github.com/xingcuntian/application NewOrientationView"] call:nil, nil][0];
    MatchaViewController *rootVC = [[MatchaViewController alloc] initWithGoValue:view];
    //rootVC.printViewHierarchyOnUpdate = true;

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.rootViewController = rootVC;
    [self.window makeKeyAndVisible];
    return YES;

}

Change to gomatcha.io/matcha/examples/application NewOrientationView, or gomatcha.io/matcha/examples NewExamplesView no problem, but Change to github.com/xingcuntian/application NewOrientationView Compilation failed, go code exactly the same

matcha init --targets="ios"
matcha build --targets="ios" github.com/xingcuntian/application

No such function: github.com/xingcuntian/application NewOrientationView
2017/12/20 22:04:38 reflect: call of reflect.Value.Call on zero Value goroutine 17 [running, locked to thread]:
runtime/debug.Stack(0xc42004cc40, 0x10212a040, 0xc4200ec3c0)
/data/golang/go/src/runtime/debug/stack.go:24 +0xa7
gomatcha.io/matcha/bridge.goRecover()
/data/go/src/gomatcha.io/matcha/bridge/go-go.go:252 +0x5a
panic(0x10212a040, 0xc4200ec3c0)
/data/golang/go/src/runtime/panic.go:491 +0x283
reflect.flag.mustBe(0x0, 0x13)
/data/golang/go/src/reflect/value.go:201 +0xc8
reflect.Value.Call(0x0, 0x0, 0x0, 0x1024746f8, 0x0, 0x0, 0x101d79089, 0xc400000008, 0xc420068040)
/data/golang/go/src/reflect/value.go:300 +0x38
gomatcha.io/matcha/bridge.matchaGoCall(0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/data/go/src/gomatcha.io/matcha/bridge/go-go.go:201 +0x126
gomatcha.io/matcha/bridge._cgoexpwrap_767ef1938d2a_matchaGoCall(0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
gomatcha.io/matcha/bridge/_obj/_cgo_gotypes.go:647 +0x8f
2017-12-20 22:04:38.955732+0800 Alph[46551:728690] *** Terminating app due to uncaught exception 'Golang Panic', reason: ''
*** First throw call stack:
(
0 CoreFoundation 0x00000001036e512b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000102d79f41 objc_exception_throw + 48
2 MatchaBridge 0x00000001020c4104 MatchaForeignPanic + 84
3 MatchaBridge 0x00000001020c184b _cgo_767ef1938d2a_Cfunc_MatchaForeignPanic + 27
4 MatchaBridge 0x0000000101da6830 runtime.asmcgocall + 112
)
libc++abi.dylib: terminating with uncaught exception of type NSException

fatal error: 'stdlib.h' file not found

I tried Matcha and can not installed it.

  1. RUN $GOPATH/bin/matcha build gomatcha.io/matcha/examples
    got errror: toolchain partially installed, run matcha init
  2. $GOPATH/bin/matcha init
    got error: go install -pkgdir=/Users/myhome/DevelopWorkspace/GoWorkspace/pkg/matcha /pkg_android_arm std failed: exit status 2

runtime/cgo

/var/folders/wm/cf8jc0wn7v1153dv9p_08yq40000gn/T/go-build267480546/runtime/cgo/_obj/_cgo_export.c:2:10: fatal error: 'stdlib.h' file not found

Before this, I installed Android Studio 2.3.3.0 which downloaded NDK 16.0.4293906.rc1. then the error happened.
So, what's wrong with my installation?

By the way,

  1. Can I just try ios only
  2. Can I use it to develop the macOS Application.

Thanks in advanced!

sunwrt

$ANDROID_HOME does not point to an Android NDK.

$ANDROID_HOME does not point to an Android NDK.
my path is " export ANDROID_HOME=/Users/phantomd/Library/Android/sdk " and i try with " export ANDROID_HOME=/Users/$USER/Library/Android/sdk/ndk-bundle "

Webviews using protobuf / grpc

There is a great library that allows a gopher to use grpc / protobuf for comms between web browser and server.
It generates gopherjs and works very well.

I was wondering if you are interesting in adding a webview to gomatcha.

It would allow us to use native GUI for forms but then webview when you need it for maybe 2d and 3d canvas.

It seem aligned because the improbable repo using protobuf like gomatcha does.
.would be happy to help.

This repo has all the code.

https://github.com/johanbrandhorst/protobuf

It's very nice to use because you can build all in golang.

i think example in getting-started is wrong (ios)

from
MatchaGoValue *rootVC = [[[MatchaGoValue alloc] initWithFunc:@"github.com/overcyn/tutorial New"] call:nil args:nil][0];
to
MatchaGoValue *rootVC = [[[MatchaGoValue alloc] initWithFunc:@"github.com/overcyn/tutorial New"] call:nil , nil][0];

Linking

I am trying to link to another objective c project that supports webrtc native.

https://github.com/ISBX/apprtc-ios/blob/master/README.md

This will allow the GUI aspect to be done with matcha and the logic in golang. Now I am trying to work out how to design the protobuf integration.

If you have any thought on it.
I am hoping that we can get set of plugin code just like react and native script has.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.