~eliasnaur/gio

2 2

Any example use in swift project

Cloud
Details
Message ID
<CAMAftoVTv49CtRi0Ab2GCwK=yJC7WYka8+btohniVWpOdBFVmw@mail.gmail.com>
DKIM signature
missing
Download raw message
Hi, all

I found an example with object c.

@import UIKit;
@import Gio;

int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil,
NSStringFromClass([GioAppDelegate class]));
}
}


Can anyone show an example with swift?

Thanks very much.
Cloud
Details
Message ID
<CAMAftoWvKk_tfP4cXk7QAUG1g+Px9KNBDmh71ALOjU+wpHztWg@mail.gmail.com>
In-Reply-To
<CAMAftoVTv49CtRi0Ab2GCwK=yJC7WYka8+btohniVWpOdBFVmw@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
I have tried both objc and swift. both failed.
Let me show steps I did:

env:
macOS: 10.15.5
XCode: 11.5
go version: go1.14.4 darwin/amd64
gomobile version +4c31acb Sun Mar 29 12:56:38 2020 +0000 (android,ios);

before:
I have already built a simple gui app with gio.

objc steps:

1. open xcode
2. create ios single view app project with object c
3. add Gioui.framework file into targets, and select do not embed, and
disable bitcode
4. replace ALL content of main.m with:

@import UIKit;
@import Gioui;
int main(int argc, char * argv[]) {
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil,
NSStringFromClass([GioAppDelegate class]));
    }
}

5. build and run on device. got error: Thread 1: EXC_BAD_ACCESS
(code=1, address=0x0)

swift steps:

1. open xcode
2. create ios single view app project with swift
3. add Gioui.framework file into targets, and select do not embed, and
disable bitcode
4. replace ALL content of AppDelegate.swift with:

import UIKit
import Gioui

@UIApplicationMain
class AppDelegate: GioAppDelegate {
    override func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions:
[UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        return super.application(application,
didFinishLaunchingWithOptions: launchOptions);
    }
}

5. build and run on device. got error: Thread 1: EXC_BAD_ACCESS
(code=1, address=0x0)

I know the error information is less, if needed, tell me and I will
create a full minimal repo.

On Mon, Jun 22, 2020 at 9:43 PM Cloud <cloud@txthinking.com> wrote:
>
> Hi, all
>
> I found an example with object c.
>
> @import UIKit;
> @import Gio;
>
> int main(int argc, char * argv[]) {
> @autoreleasepool {
> return UIApplicationMain(argc, argv, nil,
> NSStringFromClass([GioAppDelegate class]));
> }
> }
>
>
> Can anyone show an example with swift?
>
> Thanks very much.
Details
Message ID
<C3NP49TF66LH.16V2UP3J6HWZ7@themachine>
In-Reply-To
<CAMAftoWvKk_tfP4cXk7QAUG1g+Px9KNBDmh71ALOjU+wpHztWg@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
On Mon Jun 22, 2020 at 22:11, Cloud wrote:
> I have tried both objc and swift. both failed.
> Let me show steps I did:
>
> env:
> macOS: 10.15.5
> XCode: 11.5
> go version: go1.14.4 darwin/amd64
> gomobile version +4c31acb Sun Mar 29 12:56:38 2020 +0000 (android,ios);
>
> before:
> I have already built a simple gui app with gio.
>
> objc steps:
>
> 1. open xcode
> 2. create ios single view app project with object c
> 3. add Gioui.framework file into targets, and select do not embed, and
> disable bitcode
> 4. replace ALL content of main.m with:
>
> @import UIKit;
> @import Gioui;
> int main(int argc, char * argv[]) {
>     @autoreleasepool {
>         return UIApplicationMain(argc, argv, nil,
> NSStringFromClass([GioAppDelegate class]));
>     }
> }
>
> 5. build and run on device. got error: Thread 1: EXC_BAD_ACCESS
> (code=1, address=0x0)
>
> swift steps:
>
> 1. open xcode
> 2. create ios single view app project with swift
> 3. add Gioui.framework file into targets, and select do not embed, and
> disable bitcode
> 4. replace ALL content of AppDelegate.swift with:
>
> import UIKit
> import Gioui
>
> @UIApplicationMain
> class AppDelegate: GioAppDelegate {
>     override func application(_ application: UIApplication,
> didFinishLaunchingWithOptions launchOptions:
> [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
>         return super.application(application,
> didFinishLaunchingWithOptions: launchOptions);
>     }
> }
>
> 5. build and run on device. got error: Thread 1: EXC_BAD_ACCESS
> (code=1, address=0x0)
>
> I know the error information is less, if needed, tell me and I will
> create a full minimal repo.
>

I'm interested. Some questions:

- I assume you're using `-buildmode archive`. Does a program built in
the default buildmode (exe) work?
- Does your program work on the emulator?
- What is stack trace of the crash?
- Does your program work outside Xcode?

-- elias
Export thread (mbox)