Remixer 1.0.2

Remixer 1.0.2

测试已测试
语言语言 Obj-CObjective C
许可协议 Apache 2
发布最新发布2017年3月

Andres Ugarte维护。



Remixer 1.0.2

  • Google Inc.

iOS版本的Remixer

Remixer是一个框架,通过允许您在无需重建(甚至重启)应用程序的情况下调整UI变量,从而快速迭代UI更改。您可以调整数字、颜色、布尔值和字符串。想看看它的工作效果,请检查示例应用程序

如果您对在另一平台上使用Remixer感兴趣,可以查看AndroidJavaScript的仓库。无论哪个平台,都可以使用远程控制器

在您的应用程序中使用Remixer

要求

  • Xcode 7.0或更高版。
  • iOS 8.0或更高版。

快速入门

2. 创建Podfile

在Xcode中创建iOS应用程序后,您就可以开始使用Remixer for iOS了。

要在项目中初始化CocoaPods,请运行以下命令:

cd your-project-directory
pod init

3. 编辑Podfile

一旦初始化了CocoaPods,请在Podfile中将Remixer iOS Pod添加到您的目标

target "MyApp" do
  ...
  pod 'Remixer'
end

如果想要使用Remixer的远程控制器功能,需要使用pod 'Remixer/Firebase'。有关完整的设置指南,请参阅此链接

将Remixer添加到Podfile后,需要运行以下命令:

pod install
open [your-project-name].xcworkspace

4. 初始化Remixer

现在您可以开始将Remixer添加到应用程序中!首先导入Remixer头文件,然后在AppDelegate的didFinishLaunchingWithOptions中调用[RMXRemixer attachToKeyWindow]

#import "Remixer.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  self.window.rootViewController = [[UIViewController alloc] init];
  [self.window makeKeyAndVisible];

  // Let Remixer know that it can attach to the window you just created
  [RMXRemixer attachToKeyWindow];

  return YES;
}

// OPTIONAL: Make sure you propagate these two events if you're using Remote Controllers.
- (void)applicationDidBecomeActive:(UIApplication *)application {
  [RMXRemixer applicationDidBecomeActive];
}
- (void)applicationWillResignActive:(UIApplication *)application {
  [RMXRemixer applicationWillResignActive];
}

@end

5. 添加变量

要在代码中使用 Remixer 变量,只需导入 Remixer.h 并创建任意数量的变量。请记住保存您创建的变量,否则它们将被自动丢弃。

#import "Remixer.h"

@implementation ExampleViewController {
  UIView *_box;
  RMXColorVariable *_bgColorVariable;
}

- (void)viewWillAppear {
  // IMPORTANT: Create a weak reference to self to be used inside of the update block
  __weak ExampleViewController *weakSelf = self;
  // Add a color variable to control the background color of the box.  
  _bgColorVariable =
      [RMXColorVariable
          colorVariableWithKey:@"boxBgColor"
                  defaultValue:[UIColor redColor]
               limitedToValues:@[[UIColor redColor], [UIColor blueColor], [UIColor yellowColor]]
                   updateBlock:^(RMXColorVariable *variable, UIColor *selectedValue) {
                     weakSelf.box.backgroundColor = selectedValue;
                   }];
}

- (void)viewWillDisappear {
  // This is optional but it will make sure the variable is removed from the overlay when
  // you push view controllers on top of this one.
  _bgColorVariable = nil;
}

请记住,Remixer 浮层显示您应用程序当前正在使用的所有变量。如果您看到在其他地方导航后应该消失的变量,请检查您在更新块中是否只使用弱引用。

6. 精细调整它们的值

要触发应用程序中的 Remixer 面板,运行应用程序并使用三个手指向上滑动(如果您使用的是模拟器,则使用两个手指)。从这里,您可以看到正在使用的变量的控件。

您还可以使用 [RMXRemixer openPanel| 从代码中触发此浮层。

Remixer 会记住您对变量进行的精化。它是通过在 NSUserDefaults 中存储最新选择值来实现的。

贡献

我们非常欢迎贡献!如果您发现了错误,有疑问或希望做出贡献,请参阅我们的 贡献指南

material-foundation 是否是 Google 的合作伙伴?

是的,material-foundation 组织是 Google 新的工具和框架之一,用于我们 Material Design 系统。请查看我们的博客文章 设计从未完成 了解有关 Material Design 和 Remixer 如何与系统集成的更多信息。

许可证

© Google,2017。根据 Apache-2 许可证授权。