Skip to content

Commit

Permalink
Merge pull request mono#137 from apalancat/spark-inspector
Browse files Browse the repository at this point in the history
[SparkInspector] Added Spark Inspector Bindings
  • Loading branch information
dalexsoto committed Aug 21, 2013
2 parents 79fa136 + eddce05 commit ceaa99d
Show file tree
Hide file tree
Showing 15 changed files with 795 additions and 0 deletions.
2 changes: 2 additions & 0 deletions SparkInspector/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ASSEMBLY=SparkInspector.dll
include ../Rules.make
23 changes: 23 additions & 0 deletions SparkInspector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Bindings to the Spark Inspector Framework
===============================

MonoTouch bindings for `SparkInspector.framework` to use with the [Spark Inspector App](http://sparkinspector.com/)


Building
========

Run `make` to build the bindings. It assumes you have Spark Inspector installed in `/Applications/Spark Inspector.app`


Usage
===

Add the `.csproj` to your solution and add SparkInspector in your project References.

Then add these lines to your App delegate's `FinishedLaunching`

#if DEBUG
SparkInspector.EnableObservation ();
#endif

16 changes: 16 additions & 0 deletions SparkInspector/binding/ApiDefinition.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace MonoTouch.SparkInspector
{
using System;
using MonoTouch.ObjCRuntime;
using MonoTouch.Foundation;

[BaseType (typeof (NSObject))]
interface SparkInspector
{

[Static]
[Export("enableObservation")]
void EnableObservation();
}
}

16 changes: 16 additions & 0 deletions SparkInspector/binding/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#### SparkInspector
BTOUCH=/Developer/MonoTouch/usr/bin/btouch
SMCS=/Developer/MonoTouch/usr/bin/smcs

all: SparkInspector.dll

SparkInspector.a:
cp $< "/Applications/Spark Inspector.app/Contents/Resources/Frameworks/SparkInspector.framework/Versions/A/SparkInspector" $@

SparkInspector.dll: Makefile SparkInspector.linkwith.cs ApiDefinition.cs SparkInspector.a
-mkdir -p ios
$(BTOUCH) -unsafe -d:DEBUG ApiDefinition.cs -tmpdir:ios -sourceonly:ios/sources.list
$(SMCS) -noconfig -debug+ -debug:full -optimize- -out:SparkInspector.dll -resource:SparkInspector.a SparkInspector.linkwith.cs @ios/sources.list -target:library -unsafe+ -define:DEBUG -reference:/Developer/MonoTouch/usr/lib/mono/2.1/System.dll -reference:/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll -reference:/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll

clean:
-rm -rf list ios *.a *.dll *.mdb
55 changes: 55 additions & 0 deletions SparkInspector/binding/SparkInspector.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{0C767634-A668-433A-90DE-A0E0CBF32607}</ProjectGuid>
<ProjectTypeGuids>{F5B4F3BC-B597-4E2B-B552-EF5D8A32436F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>SparkInspector</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>SparkInspector</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<additionalargs>-lz</additionalargs>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<ConsolePause>False</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="monotouch" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<ObjcBindingApiDefinition Include="ApiDefinition.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Xamarin.ObjcBinding.CSharp.targets" />
<ItemGroup>
<ObjcBindingNativeLibrary Include="SparkInspector.a" />
</ItemGroup>
<ItemGroup>
<Compile Include="SparkInspector.linkwith.cs">
<DependentUpon>SparkInspector.a</DependentUpon>
</Compile>
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions SparkInspector/binding/SparkInspector.linkwith.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using System;
using MonoTouch.ObjCRuntime;

[assembly: LinkWith ("SparkInspector.a", LinkTarget.ArmV7 | LinkTarget.ArmV7s | LinkTarget.Simulator, ForceLoad = true, Frameworks = "QuartzCore")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SparkInspectorSample", "SparkInspectorSample\SparkInspectorSample.csproj", "{88B88496-BBAF-4AE1-A44D-670420632A56}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SparkInspector", "..\..\binding\SparkInspector.csproj", "{0C767634-A668-433A-90DE-A0E0CBF32607}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
Release|iPhone = Release|iPhone
Ad-Hoc|iPhone = Ad-Hoc|iPhone
AppStore|iPhone = AppStore|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0C767634-A668-433A-90DE-A0E0CBF32607}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
{0C767634-A668-433A-90DE-A0E0CBF32607}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
{0C767634-A668-433A-90DE-A0E0CBF32607}.AppStore|iPhone.ActiveCfg = Release|Any CPU
{0C767634-A668-433A-90DE-A0E0CBF32607}.AppStore|iPhone.Build.0 = Release|Any CPU
{0C767634-A668-433A-90DE-A0E0CBF32607}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{0C767634-A668-433A-90DE-A0E0CBF32607}.Debug|iPhone.Build.0 = Debug|Any CPU
{0C767634-A668-433A-90DE-A0E0CBF32607}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{0C767634-A668-433A-90DE-A0E0CBF32607}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{0C767634-A668-433A-90DE-A0E0CBF32607}.Release|iPhone.ActiveCfg = Release|Any CPU
{0C767634-A668-433A-90DE-A0E0CBF32607}.Release|iPhone.Build.0 = Release|Any CPU
{0C767634-A668-433A-90DE-A0E0CBF32607}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{0C767634-A668-433A-90DE-A0E0CBF32607}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{88B88496-BBAF-4AE1-A44D-670420632A56}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
{88B88496-BBAF-4AE1-A44D-670420632A56}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
{88B88496-BBAF-4AE1-A44D-670420632A56}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
{88B88496-BBAF-4AE1-A44D-670420632A56}.AppStore|iPhone.Build.0 = AppStore|iPhone
{88B88496-BBAF-4AE1-A44D-670420632A56}.Debug|iPhone.ActiveCfg = Debug|iPhone
{88B88496-BBAF-4AE1-A44D-670420632A56}.Debug|iPhone.Build.0 = Debug|iPhone
{88B88496-BBAF-4AE1-A44D-670420632A56}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{88B88496-BBAF-4AE1-A44D-670420632A56}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{88B88496-BBAF-4AE1-A44D-670420632A56}.Release|iPhone.ActiveCfg = Release|iPhone
{88B88496-BBAF-4AE1-A44D-670420632A56}.Release|iPhone.Build.0 = Release|iPhone
{88B88496-BBAF-4AE1-A44D-670420632A56}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{88B88496-BBAF-4AE1-A44D-670420632A56}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = SparkInspectorSample\SparkInspectorSample.csproj
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.SparkInspector;

namespace SparkInspectorSample
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
// class-level declarations
UIWindow window;
SparkInspectorSampleViewController viewController;
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);

#if DEBUG
SparkInspector.EnableObservation ();
#endif

viewController = new SparkInspectorSampleViewController ();
window.RootViewController = viewController;
window.MakeKeyAndVisible ();

return true;
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleDisplayName</key>
<string>SparkInspectorSample</string>
<key>CFBundleIdentifier</key>
<string>com.example.sparkinspectorsample</string>
<key>CFBundleVersion</key>
<string>1.0</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace SparkInspectorSample
{
public class Application
{
// This is the main entry point of the application.
static void Main (string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main (args, null, "AppDelegate");
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{88B88496-BBAF-4AE1-A44D-670420632A56}</ProjectGuid>
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>SparkInspectorSample</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>SparkInspectorSample</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchDebug>true</MtouchDebug>
<MtouchLink>None</MtouchLink>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<Optimize>true</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchLink>None</MtouchLink>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Distribution</CodesignKey>
<BuildIpa>true</BuildIpa>
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\AppStore</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignProvision>Automatic:AppStore</CodesignProvision>
<CodesignKey>iPhone Distribution</CodesignKey>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="monotouch" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="SparkInspectorSampleViewController.cs" />
<Compile Include="SparkInspectorSampleViewController.designer.cs">
<DependentUpon>SparkInspectorSampleViewController.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="SparkInspectorSampleViewController.xib" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<BundleResource Include="Resources\Default-568h%402x.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\binding\SparkInspector.csproj">
<Project>{0C767634-A668-433A-90DE-A0E0CBF32607}</Project>
<Name>SparkInspector</Name>
</ProjectReference>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace SparkInspectorSample
{
public partial class SparkInspectorSampleViewController : UIViewController
{
public SparkInspectorSampleViewController () : base ("SparkInspectorSampleViewController", null)
{
}

public override void DidReceiveMemoryWarning ()
{
// Releases the view if it doesn't have a superview.
base.DidReceiveMemoryWarning ();

// Release any cached data, images, etc that aren't in use.
}

public override void ViewDidLoad ()
{
base.ViewDidLoad ();

// Perform any additional setup after loading the view, typically from a nib.
}

public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
{
// Return true for supported orientations
return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown);
}
}
}

Loading

0 comments on commit ceaa99d

Please sign in to comment.