Skip to content
This repository has been archived by the owner on Oct 25, 2021. It is now read-only.

Missing example project and documentation for building for swift #743

Open
ThreadbareHalo opened this issue Sep 22, 2019 · 2 comments
Open

Comments

@ThreadbareHalo
Copy link

ThreadbareHalo commented Sep 22, 2019

Steps to Reproduce

  1. Follow along with weather example (https://github.com/jamesmontemagno/embeddinator-weather) until I realize I can't use delegates in obj-c ([objc] Managed to native callbacks #217)
  2. Attempt to look for a swift example in the embedding docs here (https://docs.microsoft.com/en-us/xamarin/tools/dotnet-embedding/get-started/objective-c/)

Expected Behavior

Expect to find an example or a walkthrough on how to build for swift

Actual Behavior

No walkthrough and attempting to reverse engineer the embeddinator code has gotten me so far to a

System.IO.FileNotFoundException: Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065

error. Having a super simple swift example (and hopefully a "you can use delegates" confirmation) would be greatly appreciated!

(You can take the attached project, add back in the embeddinator project and do a build in Visual Studio for Mac to reproduce issues run into from my naive attempts)

Environment

mono '${SolutionDir}/packages/Embeddinator-4000.0.4.0/tools/Embeddinator-4000.exe' 'bin/Debug/test5.dll' --target=static --platform=iOS --outdir='${SolutionDir}/iosoutput' -c --debug --gen=swift

Build Logs

Parsing assemblies...
Parsed 'test5.dll'
Processing assemblies...

Unhandled Exception:
System.IO.FileNotFoundException: Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065
at IKVM.Reflection.Universe.Load (System.String refname, IKVM.Reflection.Module requestingModule, System.Boolean throwOnError) [0x000ec] in <90104beb381b4b808b5b21c02f12857c>:0
at IKVM.Reflection.Reader.ModuleReader.ResolveAssemblyRefImpl (IKVM.Reflection.Metadata.AssemblyRefTable+Record& rec) [0x00084] in <90104beb381b4b808b5b21c02f12857c>:0
at IKVM.Reflection.Reader.ModuleReader.ResolveAssemblyRef (System.Int32 index) [0x00036] in <90104beb381b4b808b5b21c02f12857c>:0
at IKVM.Reflection.Reader.ModuleReader.ResolveType (System.Int32 metadataToken, IKVM.Reflection.IGenericContext context) [0x000ff] in <90104beb381b4b808b5b21c02f12857c>:0
at IKVM.Reflection.Reader.TypeDefImpl.get_BaseType () [0x00035] in <90104beb381b4b808b5b21c02f12857c>:0
at IKVM.Reflection.Type.get_IsEnum () [0x00001] in <90104beb381b4b808b5b21c02f12857c>:0
at Embeddinator.Generators.ASTGenerator.Visit (IKVM.Reflection.TypeInfo typeInfo) [0x00068] in <27f4a5e1850e4beb9b867456b4a97cab>:0
at Embeddinator.Generators.ASTGenerator.Visit (IKVM.Reflection.Assembly assembly) [0x00043] in <27f4a5e1850e4beb9b867456b4a97cab>:0
at Embeddinator.Driver.Process () [0x00039] in <27f4a5e1850e4beb9b867456b4a97cab>:0
at Embeddinator.Driver.Run () [0x0004e] in <27f4a5e1850e4beb9b867456b4a97cab>:0
at Embeddinator.CLI.Main (System.String[] args) [0x00092] in <27f4a5e1850e4beb9b867456b4a97cab>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065
at IKVM.Reflection.Universe.Load (System.String refname, IKVM.Reflection.Module requestingModule, System.Boolean throwOnError) [0x000ec] in <90104beb381b4b808b5b21c02f12857c>:0
at IKVM.Reflection.Reader.ModuleReader.ResolveAssemblyRefImpl (IKVM.Reflection.Metadata.AssemblyRefTable+Record& rec) [0x00084] in <90104beb381b4b808b5b21c02f12857c>:0
at IKVM.Reflection.Reader.ModuleReader.ResolveAssemblyRef (System.Int32 index) [0x00036] in <90104beb381b4b808b5b21c02f12857c>:0
at IKVM.Reflection.Reader.ModuleReader.ResolveType (System.Int32 metadataToken, IKVM.Reflection.IGenericContext context) [0x000ff] in <90104beb381b4b808b5b21c02f12857c>:0
at IKVM.Reflection.Reader.TypeDefImpl.get_BaseType () [0x00035] in <90104beb381b4b808b5b21c02f12857c>:0
at IKVM.Reflection.Type.get_IsEnum () [0x00001] in <90104beb381b4b808b5b21c02f12857c>:0
at Embeddinator.Generators.ASTGenerator.Visit (IKVM.Reflection.TypeInfo typeInfo) [0x00068] in <27f4a5e1850e4beb9b867456b4a97cab>:0
at Embeddinator.Generators.ASTGenerator.Visit (IKVM.Reflection.Assembly assembly) [0x00043] in <27f4a5e1850e4beb9b867456b4a97cab>:0
at Embeddinator.Driver.Process () [0x00039] in <27f4a5e1850e4beb9b867456b4a97cab>:0
at Embeddinator.Driver.Run () [0x0004e] in <27f4a5e1850e4beb9b867456b4a97cab>:0
at Embeddinator.CLI.Main (System.String[] args) [0x00092] in <27f4a5e1850e4beb9b867456b4a97cab>:0
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

Example Project (If Possible)

Attached is example project (minus embeddinator package because it makes the upload too big (0.4.0 version pulled in via Visual Studio for Mac))
test5.zip

@ThreadbareHalo ThreadbareHalo changed the title Example project for building for swift Missing example project and documentation for building for swift Sep 23, 2019
@chamons
Copy link
Contributor

chamons commented Sep 25, 2019

So the Embeddinator-4000 project doesn't claim to support Swift right now.

In theory, you can consume Objc into swift, so that combination it possible, but it doesn't surprise me that we don't have documentation convering it.

I'm going going to leave this open as an enhancement request.

@ThreadbareHalo
Copy link
Author

Ah, got it. I saw what looked like swift callback generators in the source and hoped it was just undocumented but seems not. It would be a great enhancement as we're currently blocked on needing a way to do callbacks to keep the code consistent with other platforms and it doesn't seem from other threads that objective c supports this. I suspect routing objc into swift wouldn't fix that. Thanks for the response!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants