问题标签 [swift4.1]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
swift4.1 - 访问类内的私有数组时出错
当我尝试访问类 (MyArray) 中的私有数组 (arr) 时,我收到一条错误消息。我想要实现的是创建一个用于反转数组内容的闭包,并且可以使用实例变量从类外部调用这个闭包。我无法理解这个错误。有人可以帮忙吗!
ios - 类型“NSAttributedStringKey”(又名“NSString”)没有成员“foregroundColor”
以下是上述问题的代码行。此问题发生在Swift 4.1
.
swift - 二元运算符“===”不能应用于“Self.Element”和“AnyObject”类型的操作数
我收到以下错误:Binary operator '===' cannot be applied to type of 'Self.Element' and 'AnyObject' on the line: return contains { $0 === object }
。
有没有办法转换object
为 的类型Iterator.Element
?这条线是否where Iterator.Element: AnyObject
意味着Iterator.Element
必须可以表示为AnyObject
?
感谢您对此事的任何帮助。
ios - SF Pro Text Medium font is not found in swift code
I'm using xCode 9.3.1 & Swift 4.1.
I'm trying to use SF Pro Text Medium font in my app code programatically. But this font is not found in the source code in swift file and app crashes.
Here is the code: NSAttributedStringKey.font: UIFont(name: ".SFProText-Medium", size: 24.0)!
At run time it throws following error: Fatal error: Unexpectedly found nil while unwrapping an Optional value
Any other standard font work.
This font is available in the storyboard and I've used it successfully.
Why doesn't it work programatically? Do I've to add it in the xCode (plist etc) to make it work?
ios - 如何使用背景图像删除 > iOS 10 和 Swift 4 中的 Tab Bar 顶部边框(阴影)?
我一直在尝试从 Swift 4 for > iOS 10 的选项卡栏中删除顶部边框(阴影)线。我也在使用自定义背景图像。我在寻找解决方案后刚刚放弃,因为它们都不起作用。
最接近的解决方案是这篇文章。
如果没有背景或 < iOS 10,则到处给出的解决方案都有效。对于 iOS > 10 并使用自定义背景图像,任何解决方案都不起作用。
我什至尝试使用透明阴影图像,但它需要将 cliptobounds 设置为 true,这不会显示自定义背景图像。
所以在所有这些解决方案结束时,我被卡住了。找不到任何可行的解决方案。
我在 AppDelegate 中设置这些自定义值,以便它适用于所有选项卡栏。
ios - 通过访问 AppDelegate 中的 Tab Bar Items 更改 Tab Bar Item Image inset
我想在我的标签栏中对齐标签栏项目图像。我知道我可以在 IB 中做到这一点,而且我做到了。但是我想以编程方式进行。我正在尝试在 AppDelegate 中执行此操作。以下是我的代码,它不起作用。谁能指出我做错了什么?
api - 蒸汽构建失败
Iam 目前是 Vapor Swift 服务器端的新手,最初我有两个查询
1)问题
蒸汽构建失败
错误:
构建失败。
2) 问题
运行时我得到 localhost:8080/Hello 这个 url 在 Safari 浏览器中工作正常
当谈到 Ios 应用程序时,我调用了我得到的 URl GET 方法
错误
获取 http:0.0.0.0:8080/Hello,HTTP 状态代码 503 时出错
如何在 Java、Javascript 等任何语言之外测试 Vapor Api