1
0
Fork 0

Adding upstream version 0.0~git20250520.a1d9079+dfsg.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-05-24 19:46:29 +02:00
parent 590ac7ff5f
commit 20149b7f3a
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
456 changed files with 70406 additions and 0 deletions

27
example/ivy/ios/README.md Normal file
View file

@ -0,0 +1,27 @@
# Ivy iOS App source
This directory contains the source code to the Ivy iOS app.
To build, first create the Mobile.xcframework out of the Go
implementation of Ivy. Run:
```
go install golang.org/x/mobile/cmd/gomobile@latest
go install golang.org/x/mobile/cmd/gobind@latest
```
to install `gomobile` and `gobind`. Then:
```
mkdir work; cd work
go mod init work
go get -d golang.org/x/mobile/bind@latest
go get -d robpike.io/ivy/mobile
gomobile bind -target=ios,iossimulator,maccatalyst,macos robpike.io/ivy/mobile robpike.io/ivy/demo
```
Place the Mobile.xcframework directory in this directory, and
then open ivy.xcodeproj in Xcode.
You have to specify Development Team for code signing certificate in:
Project Settings -> Targets -> Signing & Capabilities -> Signing -> Team.

View file

@ -0,0 +1,391 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objects = {
/* Begin PBXBuildFile section */
7DC2F7EA26DFD9870026EBED /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7DC2F7E826DFCF750026EBED /* WebKit.framework */; };
7DC2F7ED26DFD9890026EBED /* Mobile.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = B4C2833A1B98889100878964 /* Mobile.xcframework */; };
B461D25D1B31B27700EC4870 /* tape.html in Resources */ = {isa = PBXBuildFile; fileRef = B461D25C1B31B27700EC4870 /* tape.html */; };
B48878331B2E714100C7CC3C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B488780C1B2D1C3F00C7CC3C /* AppDelegate.m */; };
B48878341B2E714100C7CC3C /* IvyController.m in Sources */ = {isa = PBXBuildFile; fileRef = B488780F1B2D1C3F00C7CC3C /* IvyController.m */; };
B48878351B2E714100C7CC3C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B48878091B2D1C3F00C7CC3C /* main.m */; };
B48878371B2E714100C7CC3C /* Suggestion.m in Sources */ = {isa = PBXBuildFile; fileRef = B48878311B2DF1B200C7CC3C /* Suggestion.m */; };
B48878381B2E719000C7CC3C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B48878111B2D1C3F00C7CC3C /* Main.storyboard */; };
B48878391B2E719000C7CC3C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B48878141B2D1C3F00C7CC3C /* Images.xcassets */; };
B488783D1B2F9CD500C7CC3C /* DocsController.m in Sources */ = {isa = PBXBuildFile; fileRef = B488783C1B2F9CD500C7CC3C /* DocsController.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
7DC2F7E826DFCF750026EBED /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
B461D25C1B31B27700EC4870 /* tape.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = tape.html; sourceTree = "<group>"; };
B48878041B2D1C3F00C7CC3C /* ivy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ivy.app; sourceTree = BUILT_PRODUCTS_DIR; };
B48878081B2D1C3F00C7CC3C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
B48878091B2D1C3F00C7CC3C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
B488780B1B2D1C3F00C7CC3C /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
B488780C1B2D1C3F00C7CC3C /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
B488780E1B2D1C3F00C7CC3C /* IvyController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IvyController.h; sourceTree = "<group>"; };
B488780F1B2D1C3F00C7CC3C /* IvyController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IvyController.m; sourceTree = "<group>"; };
B48878121B2D1C3F00C7CC3C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
B48878141B2D1C3F00C7CC3C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
B48878301B2DF1B200C7CC3C /* Suggestion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Suggestion.h; sourceTree = "<group>"; };
B48878311B2DF1B200C7CC3C /* Suggestion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Suggestion.m; sourceTree = "<group>"; };
B488783B1B2F9CD500C7CC3C /* DocsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocsController.h; sourceTree = "<group>"; };
B488783C1B2F9CD500C7CC3C /* DocsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DocsController.m; sourceTree = "<group>"; };
B4C2833A1B98889100878964 /* Mobile.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = Mobile.xcframework; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
B48878011B2D1C3F00C7CC3C /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7DC2F7ED26DFD9890026EBED /* Mobile.xcframework in Frameworks */,
7DC2F7EA26DFD9870026EBED /* WebKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
7DC2F7E726DFCF740026EBED /* Frameworks */ = {
isa = PBXGroup;
children = (
7DC2F7E826DFCF750026EBED /* WebKit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
B48877FB1B2D1C3F00C7CC3C = {
isa = PBXGroup;
children = (
B4C2833A1B98889100878964 /* Mobile.xcframework */,
B48878061B2D1C3F00C7CC3C /* ivy */,
B48878051B2D1C3F00C7CC3C /* Products */,
7DC2F7E726DFCF740026EBED /* Frameworks */,
);
sourceTree = "<group>";
};
B48878051B2D1C3F00C7CC3C /* Products */ = {
isa = PBXGroup;
children = (
B48878041B2D1C3F00C7CC3C /* ivy.app */,
);
name = Products;
sourceTree = "<group>";
};
B48878061B2D1C3F00C7CC3C /* ivy */ = {
isa = PBXGroup;
children = (
B488780B1B2D1C3F00C7CC3C /* AppDelegate.h */,
B488780C1B2D1C3F00C7CC3C /* AppDelegate.m */,
B488780E1B2D1C3F00C7CC3C /* IvyController.h */,
B488780F1B2D1C3F00C7CC3C /* IvyController.m */,
B488783B1B2F9CD500C7CC3C /* DocsController.h */,
B488783C1B2F9CD500C7CC3C /* DocsController.m */,
B48878301B2DF1B200C7CC3C /* Suggestion.h */,
B48878311B2DF1B200C7CC3C /* Suggestion.m */,
B461D25C1B31B27700EC4870 /* tape.html */,
B48878111B2D1C3F00C7CC3C /* Main.storyboard */,
B48878141B2D1C3F00C7CC3C /* Images.xcassets */,
B48878071B2D1C3F00C7CC3C /* Supporting Files */,
);
path = ivy;
sourceTree = "<group>";
};
B48878071B2D1C3F00C7CC3C /* Supporting Files */ = {
isa = PBXGroup;
children = (
B48878081B2D1C3F00C7CC3C /* Info.plist */,
B48878091B2D1C3F00C7CC3C /* main.m */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
B48878031B2D1C3F00C7CC3C /* ivy */ = {
isa = PBXNativeTarget;
buildConfigurationList = B48878271B2D1C3F00C7CC3C /* Build configuration list for PBXNativeTarget "ivy" */;
buildPhases = (
B48878001B2D1C3F00C7CC3C /* Sources */,
B48878011B2D1C3F00C7CC3C /* Frameworks */,
B48878021B2D1C3F00C7CC3C /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = ivy;
productName = ivy;
productReference = B48878041B2D1C3F00C7CC3C /* ivy.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
B48877FC1B2D1C3F00C7CC3C /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "The Go Authors";
TargetAttributes = {
B48878031B2D1C3F00C7CC3C = {
CreatedOnToolsVersion = 6.1.1;
};
};
};
buildConfigurationList = B48877FF1B2D1C3F00C7CC3C /* Build configuration list for PBXProject "ivy" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = B48877FB1B2D1C3F00C7CC3C;
productRefGroup = B48878051B2D1C3F00C7CC3C /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
B48878031B2D1C3F00C7CC3C /* ivy */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
B48878021B2D1C3F00C7CC3C /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B48878381B2E719000C7CC3C /* Main.storyboard in Resources */,
B48878391B2E719000C7CC3C /* Images.xcassets in Resources */,
B461D25D1B31B27700EC4870 /* tape.html in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
B48878001B2D1C3F00C7CC3C /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B48878331B2E714100C7CC3C /* AppDelegate.m in Sources */,
B488783D1B2F9CD500C7CC3C /* DocsController.m in Sources */,
B48878341B2E714100C7CC3C /* IvyController.m in Sources */,
B48878351B2E714100C7CC3C /* main.m in Sources */,
B48878371B2E714100C7CC3C /* Suggestion.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
B48878111B2D1C3F00C7CC3C /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
B48878121B2D1C3F00C7CC3C /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
B48878251B2D1C3F00C7CC3C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = 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_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 = NO;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
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 = 14.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SUPPORTS_MACCATALYST = YES;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = "arm64 x86_64 armv7";
};
name = Debug;
};
B48878261B2D1C3F00C7CC3C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = 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_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 = NO;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
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 = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTS_MACCATALYST = YES;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VALID_ARCHS = "arm64 x86_64 armv7";
};
name = Release;
};
B48878281B2D1C3F00C7CC3C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
);
INFOPLIST_FILE = ivy/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
);
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.google.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = ivy;
STRIP_STYLE = debugging;
SUPPORTS_MACCATALYST = YES;
TARGETED_DEVICE_FAMILY = "1,2,6";
VALID_ARCHS = "arm64 x86_64 armv7";
};
name = Debug;
};
B48878291B2D1C3F00C7CC3C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
);
INFOPLIST_FILE = ivy/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
);
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.google.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = ivy;
STRIP_STYLE = debugging;
SUPPORTS_MACCATALYST = YES;
TARGETED_DEVICE_FAMILY = "1,2,6";
VALID_ARCHS = "arm64 x86_64 armv7";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
B48877FF1B2D1C3F00C7CC3C /* Build configuration list for PBXProject "ivy" */ = {
isa = XCConfigurationList;
buildConfigurations = (
B48878251B2D1C3F00C7CC3C /* Debug */,
B48878261B2D1C3F00C7CC3C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
B48878271B2D1C3F00C7CC3C /* Build configuration list for PBXNativeTarget "ivy" */ = {
isa = XCConfigurationList;
buildConfigurations = (
B48878281B2D1C3F00C7CC3C /* Debug */,
B48878291B2D1C3F00C7CC3C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = B48877FC1B2D1C3F00C7CC3C /* Project object */;
}

View file

@ -0,0 +1,14 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#import <WebKit/WebKit.h>
#import "IvyController.h"
#import "Suggestion.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate, UITextFieldDelegate, WKUIDelegate>
@property(strong, nonatomic) UIWindow *window;
@end

View file

@ -0,0 +1,35 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#import "AppDelegate.h"
#import "IvyController.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
}
- (void)applicationWillTerminate:(UIApplication *)application {
}
@end

View file

@ -0,0 +1,178 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19162" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="mTw-C8-NzX">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<accessibilityOverrides isEnabled="YES"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19144"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Docs-->
<scene sceneID="qSe-m0-5Rh">
<objects>
<viewController title="Docs" id="rfr-rm-AXI" customClass="DocsController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="TeY-hL-zeC"/>
<viewControllerLayoutGuide type="bottom" id="Yrx-qe-pYd"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="a4n-1z-obZ">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<wkWebView opaque="NO" tag="11" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xlZ-tR-6QP">
<rect key="frame" x="20" y="96" width="374" height="758"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<wkWebViewConfiguration key="configuration">
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
<wkPreferences key="preferences"/>
</wkWebViewConfiguration>
</wkWebView>
</subviews>
<color key="backgroundColor" red="0.9882352941176471" green="0.98039215686274506" blue="0.81176470588235294" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="xlZ-tR-6QP" firstAttribute="trailing" secondItem="a4n-1z-obZ" secondAttribute="trailingMargin" id="GP2-Wr-Bh9"/>
<constraint firstItem="xlZ-tR-6QP" firstAttribute="top" secondItem="TeY-hL-zeC" secondAttribute="bottom" constant="8" symbolic="YES" id="Vvo-yF-z4a"/>
<constraint firstItem="Yrx-qe-pYd" firstAttribute="top" secondItem="xlZ-tR-6QP" secondAttribute="bottom" constant="8" symbolic="YES" id="afC-pF-Eom"/>
<constraint firstItem="xlZ-tR-6QP" firstAttribute="leading" secondItem="a4n-1z-obZ" secondAttribute="leadingMargin" id="wxq-1W-9XD"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="Documentation" id="lf7-H3-aZF"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="HMz-gF-Hp5" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1724.6305418719212" y="384.80000000000001"/>
</scene>
<!--Ivy Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController title="Ivy Controller" id="BYZ-38-t0r" customClass="IvyController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleAspectFit" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" horizontalCompressionResistancePriority="1000" verticalCompressionResistancePriority="1000" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="Cn1-rU-W3R">
<rect key="frame" x="20" y="831" width="374" height="31"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" tag="1" contentMode="scaleToFill" horizontalHuggingPriority="249" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Type an expression" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="9SS-TP-C7c" userLabel="InputField">
<rect key="frame" x="0.0" y="0.0" width="301.5" height="31"/>
<color key="backgroundColor" red="0.98823529409999999" green="0.98039215690000003" blue="0.81176470590000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<rect key="contentStretch" x="1" y="1" width="1" height="1"/>
<fontDescription key="fontDescription" name="Menlo-Bold" family="Menlo" pointSize="14"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="alphabet" keyboardAppearance="alert" enablesReturnKeyAutomatically="YES" smartDashesType="no" smartInsertDeleteType="no" smartQuotesType="no"/>
<connections>
<action selector="okPressed:" destination="BYZ-38-t0r" eventType="primaryActionTriggered" id="3BK-xS-ize"/>
<action selector="okPressed:" destination="BYZ-38-t0r" eventType="editingDidEnd" id="91o-Gh-hrf"/>
</connections>
</textField>
<button opaque="NO" contentMode="scaleToFill" horizontalCompressionResistancePriority="1000" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eO6-bM-CwW">
<rect key="frame" x="301.5" y="0.0" width="72.5" height="31"/>
<accessibility key="accessibilityConfiguration" label="OK"/>
<constraints>
<constraint firstAttribute="height" constant="31" id="1nb-CV-bfg"/>
</constraints>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Button" image="return" catalog="system"/>
<connections>
<action selector="okPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="258-zN-fwW"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="9SS-TP-C7c" firstAttribute="trailing" secondItem="eO6-bM-CwW" secondAttribute="leading" id="9Fe-Sf-U5p"/>
<constraint firstItem="eO6-bM-CwW" firstAttribute="top" secondItem="9SS-TP-C7c" secondAttribute="top" id="9hv-aL-4z2"/>
<constraint firstItem="eO6-bM-CwW" firstAttribute="trailing" secondItem="Cn1-rU-W3R" secondAttribute="trailing" id="A4G-YY-4Gn"/>
<constraint firstItem="9SS-TP-C7c" firstAttribute="leading" secondItem="Cn1-rU-W3R" secondAttribute="leading" id="i2m-BU-Q4a"/>
</constraints>
</stackView>
<wkWebView opaque="NO" tag="2" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ga1-Py-9re">
<rect key="frame" x="20" y="88" width="374" height="737"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<wkWebViewConfiguration key="configuration">
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
<wkPreferences key="preferences"/>
</wkWebViewConfiguration>
</wkWebView>
</subviews>
<color key="backgroundColor" red="0.9882352941176471" green="0.98039215686274506" blue="0.81176470588235294" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="Cn1-rU-W3R" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailingMargin" id="7DU-Hc-uk7"/>
<constraint firstItem="Cn1-rU-W3R" firstAttribute="bottom" secondItem="wfy-db-euE" secondAttribute="top" id="8mr-vY-R1v"/>
<constraint firstItem="ga1-Py-9re" firstAttribute="bottom" secondItem="Cn1-rU-W3R" secondAttribute="top" constant="-6" id="BX0-OH-IJ4"/>
<constraint firstItem="ga1-Py-9re" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailingMargin" id="Fxh-TE-BtG"/>
<constraint firstItem="Cn1-rU-W3R" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="LPE-LO-nct"/>
<constraint firstItem="ga1-Py-9re" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="topMargin" id="p9M-sp-ZwC"/>
<constraint firstItem="ga1-Py-9re" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="pOi-3s-hrr"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="Ivy" id="9fD-A5-WTg">
<barButtonItem key="leftBarButtonItem" title="Clear" id="70x-xp-aiX">
<connections>
<action selector="clear:" destination="BYZ-38-t0r" id="n7k-fg-dil"/>
</connections>
</barButtonItem>
<rightBarButtonItems>
<barButtonItem title="Help" id="aDa-GJ-VpX">
<connections>
<segue destination="rfr-rm-AXI" kind="show" id="kuc-xA-dyM"/>
</connections>
</barButtonItem>
<barButtonItem title="Demo" id="ZN2-PQ-aPW">
<connections>
<action selector="demo:" destination="BYZ-38-t0r" id="NpG-yh-wMO"/>
</connections>
</barButtonItem>
</rightBarButtonItems>
</navigationItem>
<connections>
<outlet property="bottomConstraint" destination="8mr-vY-R1v" id="BqX-Do-vtq"/>
<outlet property="input" destination="9SS-TP-C7c" id="jUA-25-4WI"/>
<outlet property="okButton" destination="eO6-bM-CwW" id="o9U-hD-NDr"/>
<outlet property="tape" destination="ga1-Py-9re" id="00M-9S-MAl"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="989.85507246376824" y="382.36607142857139"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="ZgV-45-Pf8">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="mTw-C8-NzX" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" opaque="NO" contentMode="scaleToFill" id="aev-Tm-XK3">
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" red="1" green="1" blue="0.80392156859999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="barTintColor" red="1" green="1" blue="0.80392156859999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<navigationBarAppearance key="standardAppearance">
<color key="backgroundColor" red="1" green="1" blue="0.80392156859999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</navigationBarAppearance>
<navigationBarAppearance key="compactAppearance">
<color key="backgroundColor" red="1" green="1" blue="0.80392156859999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</navigationBarAppearance>
<navigationBarAppearance key="scrollEdgeAppearance">
<color key="backgroundColor" red="1" green="1" blue="0.80392156859999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</navigationBarAppearance>
</navigationBar>
<nil name="viewControllers"/>
<toolbar key="toolbar" opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="smI-B7-WbU">
<autoresizingMask key="autoresizingMask"/>
</toolbar>
<connections>
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="Nyy-d4-AXi"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="i1l-Sg-DC5" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="271" y="386"/>
</scene>
</scenes>
<resources>
<image name="return" catalog="system" width="128" height="101"/>
</resources>
</document>

View file

@ -0,0 +1,11 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#import <WebKit/WebKit.h>
// DocsController displays the documentation page.
@interface DocsController : UIViewController
@end

View file

@ -0,0 +1,42 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#import "DocsController.h"
#import "mobile/Mobile.h"
@interface DocsController () {
WKWebView *webView;
}
@end
@implementation DocsController
- (void)viewDidLoad {
[super viewDidLoad];
webView = (WKWebView *)[self.view viewWithTag:11];
NSString *helpHTML = MobileHelp();
NSRange r = [helpHTML rangeOfString:@"<head>"];
NSString *html = [helpHTML substringToIndex:r.location];
// With the following meta tag, WKWebView displays the fonts more nicely.
NSString *meta = @"<meta name='viewport' \
content='width=device-width, "
@"initial-scale=1.0, maximum-scale=1.0, \
minimum-scale=1.0, "
@"user-scalable=no'>";
html = [html stringByAppendingString:@"<head>"];
html = [html stringByAppendingString:meta];
html = [html stringByAppendingString:[helpHTML substringFromIndex:r.location]];
[webView loadHTMLString:html baseURL:NULL];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end

View file

@ -0,0 +1,300 @@
{
"images" : [
{
"filename" : "icon-40.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "icon-60.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"filename" : "icon-58.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "icon-87.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"filename" : "icon-80.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "icon-120.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"filename" : "icon-120.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"filename" : "icon-180.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"filename" : "icon-20.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"filename" : "icon-40.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "icon-29.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"filename" : "icon-58.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "icon-40.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"filename" : "icon-80.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "icon-76.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"filename" : "icon-152.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"filename" : "icon-167.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"filename" : "icon-1024.png",
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
},
{
"filename" : "icon-120.png",
"idiom" : "car",
"scale" : "2x",
"size" : "60x60"
},
{
"filename" : "icon-180.png",
"idiom" : "car",
"scale" : "3x",
"size" : "60x60"
},
{
"filename" : "icon-48.png",
"idiom" : "watch",
"role" : "notificationCenter",
"scale" : "2x",
"size" : "24x24",
"subtype" : "38mm"
},
{
"filename" : "icon-55.png",
"idiom" : "watch",
"role" : "notificationCenter",
"scale" : "2x",
"size" : "27.5x27.5",
"subtype" : "42mm"
},
{
"filename" : "icon-58.png",
"idiom" : "watch",
"role" : "companionSettings",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "icon-87.png",
"idiom" : "watch",
"role" : "companionSettings",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "watch",
"role" : "notificationCenter",
"scale" : "2x",
"size" : "33x33",
"subtype" : "45mm"
},
{
"filename" : "icon-80.png",
"idiom" : "watch",
"role" : "appLauncher",
"scale" : "2x",
"size" : "40x40",
"subtype" : "38mm"
},
{
"filename" : "icon-88.png",
"idiom" : "watch",
"role" : "appLauncher",
"scale" : "2x",
"size" : "44x44",
"subtype" : "40mm"
},
{
"idiom" : "watch",
"role" : "appLauncher",
"scale" : "2x",
"size" : "46x46",
"subtype" : "41mm"
},
{
"filename" : "icon-100.png",
"idiom" : "watch",
"role" : "appLauncher",
"scale" : "2x",
"size" : "50x50",
"subtype" : "44mm"
},
{
"idiom" : "watch",
"role" : "appLauncher",
"scale" : "2x",
"size" : "51x51",
"subtype" : "45mm"
},
{
"filename" : "icon-172.png",
"idiom" : "watch",
"role" : "quickLook",
"scale" : "2x",
"size" : "86x86",
"subtype" : "38mm"
},
{
"filename" : "icon-196.png",
"idiom" : "watch",
"role" : "quickLook",
"scale" : "2x",
"size" : "98x98",
"subtype" : "42mm"
},
{
"filename" : "icon-216.png",
"idiom" : "watch",
"role" : "quickLook",
"scale" : "2x",
"size" : "108x108",
"subtype" : "44mm"
},
{
"idiom" : "watch",
"role" : "quickLook",
"scale" : "2x",
"size" : "117x117",
"subtype" : "45mm"
},
{
"filename" : "icon-1024.png",
"idiom" : "watch-marketing",
"scale" : "1x",
"size" : "1024x1024"
},
{
"filename" : "icon-16.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"filename" : "icon-32.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "icon-32.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "icon-64.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "icon-128.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "icon-256.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "icon-256.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "icon-512.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "icon-512.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "icon-1024.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 957 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

View file

@ -0,0 +1,52 @@
<?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>UIUserInterfaceStyle</key>
<string>Light</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Ivy</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.google.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>6</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>Launch</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array/>
<key>UIRequiresFullScreen</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View file

@ -0,0 +1,25 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#import <UIKit/UIKit.h>
#import <WebKit/WebKit.h>
#import "Suggestion.h"
// IvyController displays the main app view.
@interface IvyController : UIViewController <UITextFieldDelegate, WKUIDelegate, SuggestionDelegate>
@property(weak, nonatomic) IBOutlet NSLayoutConstraint *bottomConstraint;
// A text input field coupled to an output "tape", rendered with a WKWebView.
@property(weak, nonatomic) IBOutlet UITextField *input;
@property(strong, nonatomic) Suggestion *suggestionView;
@property(weak, nonatomic) IBOutlet WKWebView *tape;
@property(weak, nonatomic) IBOutlet UIButton *okButton;
- (IBAction)clear:(id)sender;
- (IBAction)demo:(id)sender;
- (IBAction)okPressed:(id)sender;
@end

View file

@ -0,0 +1,216 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#import "IvyController.h"
#import "mobile/Mobile.h"
@interface IvyController ()
@end
@implementation IvyController {
NSArray *demo_lines;
int demo_index;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.input.delegate = self;
self.input.autocorrectionType = UITextAutocorrectionTypeNo;
self.input.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
self.suggestionView = [[Suggestion alloc] init];
self.suggestionView.delegate = self;
self.tape.UIDelegate = self;
self->demo_lines = NULL;
[self.okButton setTitle:@"" forState:UIControlStateNormal];
[self.okButton setHidden:TRUE];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(textDidChange:)
name:UITextFieldTextDidChangeNotification
object:self.input];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
[self.input becomeFirstResponder];
[self clear:NULL];
}
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
if ([textField isEqual:self.input]) {
textField.inputAccessoryView = self.suggestionView;
textField.autocorrectionType = UITextAutocorrectionTypeNo;
[textField reloadInputViews];
}
return YES;
}
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
if ([textField isEqual:self.input]) {
textField.inputAccessoryView = nil;
[textField reloadInputViews];
}
return YES;
}
- (void)textDidChange:(NSNotification *)notif {
[self.suggestionView suggestFor:self.input.text];
}
- (void)suggestionReplace:(NSString *)text {
self.input.text = text;
[self.suggestionView suggestFor:text];
}
- (void)keyboardWillShow:(NSNotification *)aNotification {
// Move the input text field up, as the keyboard has taken some of the screen.
NSDictionary *info = [aNotification userInfo];
CGRect kbFrame = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
NSNumber *duration = [info objectForKey:UIKeyboardAnimationDurationUserInfoKey];
UIViewAnimationCurve keyboardTransitionAnimationCurve;
[[info valueForKey:UIKeyboardAnimationCurveUserInfoKey]
getValue:&keyboardTransitionAnimationCurve];
UIViewAnimationOptions options =
keyboardTransitionAnimationCurve | keyboardTransitionAnimationCurve << 16;
[UIView animateWithDuration:duration.floatValue
delay:0
options:options
animations:^{
self.bottomConstraint.constant = 0 - kbFrame.size.height;
[self.view layoutIfNeeded];
}
completion:^(BOOL finished) {
[self scrollTapeToBottom];
}];
}
- (void)keyboardWillHide:(NSNotification *)aNotification {
// Move the input text field back down.
NSDictionary *info = [aNotification userInfo];
NSNumber *duration = [info objectForKey:UIKeyboardAnimationDurationUserInfoKey];
UIViewAnimationCurve keyboardTransitionAnimationCurve;
[[info valueForKey:UIKeyboardAnimationCurveUserInfoKey]
getValue:&keyboardTransitionAnimationCurve];
UIViewAnimationOptions options =
keyboardTransitionAnimationCurve | keyboardTransitionAnimationCurve << 16;
int offset = self.input.inputAccessoryView != NULL ? self.suggestionView.frame.size.height : 0;
[UIView animateWithDuration:duration.floatValue
delay:0
options:options
animations:^{
self.bottomConstraint.constant = 0 - offset;
[self.view layoutIfNeeded];
}
completion:^(BOOL finished) {
[self scrollTapeToBottom];
}];
}
- (void)enterPressed {
NSString *text = self.input.text;
if ([text isEqual:@""]) {
if (self->demo_lines == NULL) {
return;
}
while (demo_index < self->demo_lines.count) {
NSString *line = self->demo_lines[self->demo_index++];
if ([line hasPrefix:@"#"]) {
[self appendTape:line tag:@"comment"];
} else {
self.input.text = line;
break;
}
}
} else if (self->demo_lines != NULL && [text isEqual:@"quit"]) {
[self unloadDemo];
} else {
[self appendTape:text tag:@"expr"];
NSString *expr = [text stringByAppendingString:@"\n"];
NSError *err;
NSString *result = MobileEval(expr, &err);
if (err != nil) {
result = err.description;
}
result = [result stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];
result = [result stringByReplacingOccurrencesOfString:@"<" withString:@"&lt;"];
result = [result stringByReplacingOccurrencesOfString:@">" withString:@"&gt;"];
NSMutableArray *lines = (NSMutableArray *)[result componentsSeparatedByString:@"\n"];
for (NSMutableString *line in lines) {
if ([line hasPrefix:@"#"])
[self appendTape:line tag:@"comment"];
else
[self appendTape:line tag:@"result"];
}
self.input.text = @"";
}
[self.input becomeFirstResponder];
}
- (void)scrollTapeToBottom {
NSString *scroll = @"window.scrollBy(0, document.body.offsetHeight);";
[self.tape evaluateJavaScript:scroll completionHandler:nil];
}
- (void)appendTape:(NSString *)text tag:(NSString *)tag {
NSString *injectSrc = @"appendDiv('%@','%@');";
NSString *runToInject = [NSString stringWithFormat:injectSrc, text, tag];
[self.tape evaluateJavaScript:runToInject completionHandler:nil];
[self scrollTapeToBottom];
}
- (void)loadDemo {
[self.okButton setHidden:FALSE];
NSString *text = DemoText();
self->demo_lines =
[text componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];
self->demo_index = 0;
self.input.text = @"";
self.input.enablesReturnKeyAutomatically = TRUE;
[self enterPressed];
}
- (void)unloadDemo {
[self.okButton setHidden:TRUE];
self.input.enablesReturnKeyAutomatically = FALSE;
self->demo_lines = NULL;
self.input.text = @"";
}
- (IBAction)okPressed:(id)sender {
[self enterPressed];
}
- (IBAction)demo:(id)sender {
if (self->demo_lines) { // demo already running
[self enterPressed];
} else {
[self loadDemo];
}
}
- (IBAction)clear:(id)sender {
[self unloadDemo];
NSString *string = [NSString
stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"tape" ofType:@"html"]
encoding:NSUTF8StringEncoding
error:NULL];
[self.tape loadHTMLString:string baseURL:NULL];
}
@end

View file

@ -0,0 +1,22 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#import <UIKit/UIKit.h>
@protocol SuggestionDelegate <NSObject>
@required
- (void)suggestionReplace:(NSString *)text;
@end
@interface Suggestion : UIInputView
- (instancetype)init;
- (instancetype)initWithFrame:(CGRect)frame;
- (void)suggestFor:(NSString *)text;
@property(weak) id<SuggestionDelegate> delegate;
@end

View file

@ -0,0 +1,164 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#import "Suggestion.h"
#define maxSuggestions 4 + 3
@implementation Suggestion {
NSString *text;
NSRange range;
NSMutableOrderedSet *options;
NSMutableArray *buttons;
NSArray *possibleSuggestions;
NSCharacterSet *breakingChars;
}
- (instancetype)init {
CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
self = [self initWithFrame:CGRectMake(0.0f, 0.0f, screenWidth, 36.0f)];
return self;
}
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame inputViewStyle:UIInputViewStyleKeyboard];
if (self) {
possibleSuggestions = @[
@")base ", @")debug ", @")format ", @")maxdigits ", @")op ", @")origin ", @")prec ",
@")prompt ", @")seed ", @"cos ", @"iota ", @"log ", @"max ", @"min ", @"pi ", @"rho ",
@"sin ", @"sqrt ", @"tan "
];
breakingChars = [NSCharacterSet characterSetWithCharactersInString:@"/+-*,^|= "];
options = [[NSMutableOrderedSet alloc] initWithCapacity:maxSuggestions];
buttons = [[NSMutableArray alloc] init];
self.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.05f];
[self setSuggestions:nil];
}
return self;
}
- (void)suggestFor:(NSString *)t {
text = t;
range = [text rangeOfCharacterFromSet:breakingChars options:NSBackwardsSearch];
if (range.location == NSNotFound) {
range.location = 0;
range.length = text.length;
} else {
if (range.location > 0 && [text characterAtIndex:range.location - 1] == ')') {
// Special case for suggestions that start with ") ".
range.location -= 1;
range.length++;
} else {
range.location += 1;
range.length -= 0;
}
}
range.length = text.length - range.location;
if (range.length == 0) {
[self setSuggestions:nil];
} else {
NSString *prefix = [text substringWithRange:range];
// TODO: make not so slow.
NSArray *suggestions = @[];
for (NSString *suggestion in possibleSuggestions) {
if ([suggestion hasPrefix:prefix] && prefix.length < suggestion.length) {
suggestions = [suggestions arrayByAddingObject:suggestion];
}
}
if (suggestions.count > 3) {
suggestions = nil;
}
[self setSuggestions:suggestions];
}
[self setNeedsLayout];
}
- (void)setSuggestions:(NSArray *)suggestions {
[options removeAllObjects];
if ([suggestions respondsToSelector:@selector(countByEnumeratingWithState:objects:count:)]) {
for (NSString *suggestion in suggestions) {
if (options.count < maxSuggestions) {
[options addObject:suggestion];
} else {
break;
}
}
}
}
- (void)layoutSubview:(NSString *)t at:(CGFloat)x width:(CGFloat)w {
UIButton *b = [[UIButton alloc] initWithFrame:CGRectMake(x, 0.0f, w, self.bounds.size.height)];
[b setTitle:t forState:UIControlStateNormal];
b.titleLabel.adjustsFontSizeToFitWidth = YES;
b.titleLabel.textAlignment = NSTextAlignmentCenter;
[b setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[b addTarget:self action:@selector(buttonTouched:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:b];
if (x > 0) {
UIView *line =
[[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 0.5f, self.bounds.size.height)];
line.backgroundColor = [UIColor colorWithRed:0.984 green:0.977 blue:0.81 alpha:1.0];
[b addSubview:line];
}
[buttons addObject:b];
}
- (void)layoutSubviews {
for (UIView *subview in buttons) {
[subview removeFromSuperview];
}
[buttons removeAllObjects];
CGFloat symbolWidth = 40.0f;
[self layoutSubview:@"+" at:0 * symbolWidth width:symbolWidth];
[self layoutSubview:@"-" at:1 * symbolWidth width:symbolWidth];
[self layoutSubview:@"*" at:2 * symbolWidth width:symbolWidth];
[self layoutSubview:@"/" at:3 * symbolWidth width:symbolWidth];
for (int i = 0; i < options.count; i++) {
NSString *suggestion = options[i];
CGFloat width = (self.bounds.size.width - (4 * symbolWidth)) / options.count;
CGFloat x = (4 * symbolWidth) + (i * width);
[self layoutSubview:suggestion at:x width:width];
}
}
- (void)buttonTouched:(UIButton *)button {
NSTimeInterval duration = 0.08f;
[UIView animateWithDuration:duration
animations:^{
[button setBackgroundColor:[UIColor whiteColor]];
if ([self.delegate respondsToSelector:@selector(suggestionReplace:)]) {
NSString *t = self->text;
if (t == nil) {
t = @"";
}
if (button.currentTitle.length == 1) {
// Special case for +, -, *, /.
t = [t stringByAppendingString:button.currentTitle];
} else {
t = [self->text stringByReplacingCharactersInRange:self->range
withString:button.currentTitle];
}
[self performSelector:@selector(suggestionReplace:)
withObject:t
afterDelay:duration * 0.8f];
}
[button performSelector:@selector(setBackgroundColor:)
withObject:[UIColor clearColor]
afterDelay:duration];
}];
}
- (void)suggestionReplace:(NSString *)t {
[self.delegate performSelector:@selector(suggestionReplace:) withObject:t];
}
@end

View file

@ -0,0 +1,18 @@
/* Class = "UITextField"; placeholder = "Type an expression"; ObjectID = "9SS-TP-C7c"; */
"9SS-TP-C7c.placeholder" = "Type an expression";
/* Class = "UIViewController"; title = "Ivy Controller"; ObjectID = "BYZ-38-t0r"; */
"BYZ-38-t0r.title" = "Ivy Controller";
/* Class = "UIBarButtonItem"; title = "Help"; ObjectID = "GSn-BW-al6"; */
"GSn-BW-al6.title" = "Help";
/* Class = "UINavigationItem"; title = "Ivy"; ObjectID = "KhW-J4-UcU"; */
"KhW-J4-UcU.title" = "Ivy";
/* Class = "UINavigationItem"; title = "Documentation"; ObjectID = "lf7-H3-aZF"; */
"lf7-H3-aZF.title" = "Documentation";
/* Class = "UIViewController"; title = "Docs"; ObjectID = "rfr-rm-AXI"; */
"rfr-rm-AXI.title" = "Docs";

View file

@ -0,0 +1,11 @@
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char *argv[])
{
@autoreleasepool
{
return UIApplicationMain(argc, argv, nil,
NSStringFromClass([AppDelegate class]));
}
}

View file

@ -0,0 +1,61 @@
<!--
Copyright 2015 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" charset="UTF-8">
<style>
body {
font-family: sans-serif;
}
div {
padding: 1;
white-space: pre-wrap;
font-family: "Roboto Mono", monospace;
}
.comment {
color: grey;
}
.expr {
font-weight: bold;
}
.flow-hide {
text-overflow: ellipsis;
word-break: break-all;
white-space: nowrap;
overflow: hidden;
}
.flow-show {
word-break: break-all;
}
</style>
<script>
function flowClick(el) {
el.classList.toggle("flow-hide");
el.classList.toggle("flow-show");
}
function appendDiv(txt, tag) {
var el = document.createElement("div");
el.innerHTML = txt;
if (tag == "comment") {
el.classList.add("comment");
} else if (tag == "expr") {
el.classList.add("expr");
} else {
el.classList.add("flow-show");
el.onclick = function() {
flowClick(el);
};
}
document.body.appendChild(el);
}
</script>
<body>
</body>
</html>