在之前的Xcode版本中,我可以通过简单的Cmd +单击该方法/变量来跳转到定义 .但是在Xcode 9中,我对跳到定义感到不舒服.
有没有人有更好的解决方案跳转到Xcode 9中的定义?
我厌倦了从下拉列表中选择选项.
iOS 11 Beta 1几乎为所有系统应用程序使用增加的导航栏标题(它开始在iOS 10和音乐应用程序中执行此操作).我想知道Apple是否有iOS 11的公共API,或者它现在是否会保密.
行为是标题具有增加的字体大小,左对齐并且一旦用户向下滚动就会移动到导航栏.我在这里的消息应用程序中附加了一些显示此行为的屏幕.
虽然我无法找到任何的参考UINavigationController和UINavigationBar到目前为止,也许有人知道一些细节!
我通常在iOS上使用自定义UIColors使用Swift扩展,但现在使用iOS11/XCode9我们可以创建颜色集.我们怎样才能使用它们?
更新 - 提示
正如@Cœur所说,我们可以拖放de color,并像UIColor对象一样使用它,可能的解决方案可以用作扩展:
或者作为常数:
现在我想知道我们是否可以访问它们,就像UIImage访问资产图像一样,如:
UIImage(named: "image-name") -> UIColor(named: "color-name")
Run Code Online (Sandbox Code Playgroud) 我正在尝试将mi app升级到swift 4,但条形码阅读器无法正常工作.
我已经隔离了条形码阅读器代码,但仍然无法正常工作.相机可以正常工作但不会检测到条形码.
代码在swift 3 iOS 10上运行得很好.
这是完整的代码
import AVFoundation
import UIKit
class ViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate {
var captureSession: AVCaptureSession!
var previewLayer: AVCaptureVideoPreviewLayer!
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = UIColor.black
captureSession = AVCaptureSession()
let videoCaptureDevice = AVCaptureDevice.default(for: AVMediaType.video)
let videoInput: AVCaptureDeviceInput
do {
videoInput = try AVCaptureDeviceInput(device: videoCaptureDevice!)
} catch {
return
}
if (captureSession.canAddInput(videoInput)) {
captureSession.addInput(videoInput)
} else {
failed();
return;
}
let metadataOutput = AVCaptureMetadataOutput()
if (captureSession.canAddOutput(metadataOutput)) {
captureSession.addOutput(metadataOutput)
metadataOutput.setMetadataObjectsDelegate(self, queue: DispatchQueue.main)
metadataOutput.metadataObjectTypes = [AVMetadataObject.ObjectType.ean8, AVMetadataObject.ObjectType.ean13, …Run Code Online (Sandbox Code Playgroud) 在Xcode 9中为Swift 4进行光泽项目之后
我得到以下错误,我不知道
闭包元组参数'(key:_,value:_)'不支持解构
码:
extension Dictionary
{
init(elements: [Element]) {
self.init()
for (key, value) in elements {
self[key] = value
}
}
func flatMap<KeyPrime, ValuePrime>(_ transform: (Key, Value) throws -> (KeyPrime, ValuePrime)?) rethrows -> [KeyPrime:ValuePrime] {
return Dictionary<KeyPrime, ValuePrime>(elements: try flatMap({ (key, value) in
return try transform(key, value)
}))
}
}
Run Code Online (Sandbox Code Playgroud)
此时出现错误 try flatMap({ (key, value)in
我们有足够大的项目,使用Swift 2.x构建,现在Apple刚刚发布了Swift 4,以便向前推进最新版本的Swift,我们可以选择这条路径......
我们需要先将代码迁移到Swift 3吗?或者我们可以使用Xcode 9直接将代码迁移到Swift 4?
我在撰写本文时正在测试Xcode 9 beta 3.
在查看故事板时,我收到一个警告列表,表明在其他语言/地区,我的固定约束会造成问题.
该应用程序相当复杂,许多视图正在经历这些警告.
警告是:
Certain autolayout constraint combinations may result in an appropriate layout in the current development language but will pose issues in other languages and regions.
我知道该应用程序不会很快用于任何其他语言.
有什么方法可以关闭这个警告吗?这听起来很傻但我无法忍受看到我的所有观点都带有黄色的警告图标并计入顶部(110警告!)
我的项目使用Objective-C和Swift代码.当用户登录时,它会为用户首选项调用一组apis,我有一个DataCoordinator.swift类来调度API操作,我从UserDetailViewController.m类调用此类来加载用户首选项.在使用Xcode 9 beta 4将我的代码迁移到Swift 4之前,这种用法正常工作.现在当我登录时,我在DataCoordinator类中给出了这个错误.下面是我的DataCoordinator和Viewcontroller类的示例.
DataCoordinator.swift
import UIKit
@objcMembers
class DataCoordinator: NSObject {
//MARK:- Private
fileprivate var user = myDataStore.sharedInstance().user
fileprivate var preferenceFetchOperations = [FetchOperation]()
fileprivate func scheduleFetchOperation(_ operation:FetchOperation, inFetchOperations operations:inout [FetchOperation]) {
guard operations.index(of: operation) == nil else { return }
operations.append(operation)
}
fileprivate func completeFetchOperation(_ fetchOperation:FetchOperation, withError error:Error?, andCompletionHandler handler:@escaping FetchCompletionHandler) {
func removeOperation(_ operation:FetchOperation, fromOperations operations:inout [FetchOperation]) {
if operations.count > 0 {
operations.remove(at: operations.index(of: fetchOperation)!)
handler(error)
}
}
if preferenceFetchOperations.contains(fetchOperation) {
removeOperation(fetchOperation, fromOperations: &preferenceFetchOperations)
}
} …Run Code Online (Sandbox Code Playgroud) 我正在使用Xcode 8.3.2进行iOS应用程序开发.我刚安装了Xcode 9.0 Beta,突然发现我的旧模拟器在我的Xcode 8.3.2中丢失了.
安装Xcode 9.0 Beta后出现此问题.
见下面的图片.
1. Xcode 8.3.2.
2. Xcode 9.0 Beta.
我通过下面的链接,但没有一个是有帮助的.
所以请帮助我.
xcode9-beta ×10
ios ×5
swift ×5
ios11 ×4
swift4 ×4
xcode ×2
barcode ×1
crash ×1
iphone ×1
objective-c ×1
shortcut ×1
storyboard ×1
swift2 ×1
uicolor ×1
xcode8 ×1