小编mok*_*gio的帖子

使用 vscode 和 vim 插件缩进多行/块

已经在网站上,但它对我不起作用。我不确定答案是否适合我的情况(问题询问有关 vim“模式”)。如果是,那么所接受答案的上下文对我来说并不明显。

我认为应该拼接 JSON 片段

{
  "key": "shift+tab",
  "command": "outdent",
  "when": "editorTextFocus && !editorReadonly && !editorTabMovesFocus"
}
Run Code Online (Sandbox Code Playgroud)

进入我们的设置,但不清楚如何或在哪里。该应用程序有一个settings.json,一个keybindings.json,插件有package.json。

大约一年前,我在 IIRC 上让它在 vim 中工作,但它需要一个插件和一些设置。

编辑添加: ctrl+[ 和 ctrl+] 对我来说不起作用。据推测,它们没有 vim 插件,但该插件会覆盖 ctrl 命令。

vim formatting visual-studio-code

4
推荐指数
1
解决办法
6720
查看次数

单元测试用例中的灰色指示器是什么

使用XCTExpectFailure并运行测试用例时 ( Cmd + U) 从“显示测试导航器”中,它显示灰色十字 (x) 其他测试用例以绿色显示。

测试用例中的灰色指示器 (x) 是什么?

在此输入图像描述

需要在这里做什么吗?

xcode unit-testing

4
推荐指数
1
解决办法
467
查看次数

对于“墨西哥西班牙语”区域设置,您应该在 Xcode 中使用什么本地化代码

在 iTunes connect 中,您可以提交西班牙语和墨西哥西班牙语本地化版本。我在西班牙(西班牙语)中使用“spa”区域设置,但“spm”在模拟器中不适用于墨西哥。

理想情况下,我想我想使用适用于所有拉丁美洲国家西班牙语的区域设置代码,因为我认为他们更喜欢墨西哥变体。

正确的使用代码是什么?

iphone xcode localization

3
推荐指数
1
解决办法
3487
查看次数

在其他平移手势后告诉ScrollView滚动

我无法获得滚动视图(在表格视图中)滚动.基本上,我有一个if语句,用于检查水平移动是否大于垂直移动.如果是,则在单元格上执行平移手势.另外,我希望tableview能够正常滚动.我尝试过使用一些变体,self.scrollview.enabled = yes但我无法使用它.

它适用于水平平移手势,但我不能让它在else部分正确滚动.这是最相关的代码:(对不起,如果它很糟糕 - 我还是iOS/Objective C的新手).哦,如果你在代码提取中随机看到一个奇怪的'代码',请忽略它 - 我在格式化时遇到了一些问题而且我丢了一个字.

-(void)handlePan:(UIPanGestureRecognizer *)panGestureRecognizer
{
    CGPoint location = [panGestureRecognizer locationInView:_tableView];

    //Get the corresponding index path within the table view
    NSIndexPath *indexPath = [_tableView indexPathForRowAtPoint:location];
    TVTableCell *cell = [_tableView cellForRowAtIndexPath:indexPath];

    CGPoint translation = [panGestureRecognizer translationInView:cell];
    // Check for horizontal gesture
    if (fabsf(translation.x) > fabsf(translation.y)) {
        CGPoint originalCenter = cell.center;

        if (panGestureRecognizer.state == UIGestureRecognizerStateBegan) {
            NSLog(@"pan gesture started");
        }

        if (panGestureRecognizer.state == UIGestureRecognizerStateChanged) {
            // translate the center

            CGPoint translation = [panGestureRecognizer translationInView:self.view]; …
Run Code Online (Sandbox Code Playgroud)

iphone scrollview ipad ios

3
推荐指数
1
解决办法
5199
查看次数

单元测试在iOS中呈现了视图控制器和键盘

我正在尝试编写单元测试以确保键盘和呈现的视图控制器被正确触发,但我得到的奇怪行为我不明白,我认为这与行为有关UIWindow.我正在使用QuickNimble,但我已经用vanilla进行了测试XCTest并得到了同样的问题.

我的代码:

import Quick
import Nimble

class TestSpec: QuickSpec {
    override func spec() {

        let sut = UIViewController()

        // The window is nil when this test is run in isolation
        UIApplication.shared.keyWindow?.rootViewController = sut

        // This does not work either
        let window = UIWindow(frame: UIScreen.main.bounds)
        window.rootViewController = sut
        window.makeKeyAndVisible()

        describe("ViewController") {

            it("presents a UIAlertController") {
                let alert = UIAlertController(title: "Test", message: "This is a test", preferredStyle: .alert)
                let okAction = UIAlertAction(title: "OK", style: …
Run Code Online (Sandbox Code Playgroud)

unit-testing ios swift

3
推荐指数
1
解决办法
2578
查看次数

Quick-Nimble框架中是否有等效的XCTFail()?

对于特定情况,我需要在Quick - Nimble框架中无条件生成测试用例失败。我该怎么做呢?等效XCTFail("Expecting to get failure callback")将是有帮助的。

unit-testing swift quick-nimble

3
推荐指数
1
解决办法
448
查看次数

Ambiguous type name in Swift unit test

Recently I spent quite some time to figure it out the issue with my unit test. The error that I saw in my unit test is :

Ambiguous type name 'AssetIdentifier' in 'UIImage'
Run Code Online (Sandbox Code Playgroud)

This is the complete code :

import XCTest
import module
@testable import module

class VoucherOptionsViewControllerTests: XCTestCase {
    lazy var result = ""

    class VoucherOptionsViewControllerMock: VoucherOptionsViewController {

        var result = ""

        override func showOverlayView(title: String, message: String, assetIdentifier: UIImage.AssetIdentifier) {
            self.result = "lalalala"
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

AssetIdentifier is …

unit-testing ios swift

1
推荐指数
1
解决办法
1224
查看次数