天道酬勤,学无止境

swift-playground

Transition PageCurl to Scroll with UIPageViewController

问题 我想在视图之间更改我的动画。 目前我有 PageCurl 但我想要一个像 Snapchat 这样的滚动动画。 我不能使用var transitionStyle: UIPageViewControllerTransitionStyle { get } 我的视图控制器: import UIKit class ViewController: UIPageViewController, UIPageViewControllerDataSource{ let pageViewController = UIPageViewController(transitionStyle: .Scroll, navigationOrientation: .Horizontal, options: nil) var messagesViewController : MessagesViewController! var searchViewController : SearchViewController! var friendsViewController : FriendsViewController! override func viewDidLoad() { super.viewDidLoad() // set UIPageViewControllerDataSource self

2022-05-10 01:47:05    分类:技术分享    ios   swift   xcode6   uipageviewcontroller   swift-playground

Xcode 10 playground is not showing the output

I am using Xcode 10 on macOS Mojave 10.14.4. When I open the playground I am unable to get the output window to output anything, even using the print command it stays blank. Is there any other program for mac that shows output as you code in swift? Or has anyone encountered and was able to fix this problem?

2022-05-01 07:31:44    分类:问答    swift-playground   xcode10

How to setup ViewController in Playgrounds?

问题 回答1 import UIKit import PlaygroundSupport class ViewController: UIViewController{ override func viewDidLoad() { super.viewDidLoad() // do setup here } } let viewController = ViewController() PlaygroundPage.current.liveView = viewController PlaygroundPage.current.needsIndefiniteExecution = true 回答2 具有多个子视图和自动布局的 Playground 中的 UIViewController 示例。 import UIKit import PlaygroundSupport class ViewController : UIViewController { var yellowView: UIView! var redView: UIView! override func loadView() { // UI let view = UIView() view.backgroundColor = .white yellowView = UIView() yellowView

2022-05-01 07:13:13    分类:技术分享    swift   xcode   uiviewcontroller   swift-playground

How to add an image to an ARSCNScene in Swift?

I stumbled upon a roadblock with the development of a Swift playground I'm developing. I want to add an image to my ARSCNScene (ARKit + SceneKit). Not as a background, but as an actual node with positions and all. Does anyone know whether this is possible? I couldn't find anything online. Thanks!

2022-04-30 10:34:08    分类:问答    swift   scenekit   arkit   swift-playground

Linking pages in Swift Playgrounds [Xcode]

I am new to swift playgrounds and ran into some problems while making a swift playground in Xcode. This is my main Playground page import UIKit import PlaygroundSupport import SpriteKit let secondScene = Index() let master = FirstScene() let root = UINavigationController(rootViewController: master) PlaygroundPage.current.liveView = root But when I tried adding Next Topic in both the source class in Swift and the playground page itself the link does not appear. NOTE: I am using Swift Playgrounds in Xcode not a Playgroundbook on an iPad. Also, inside sources folder of my main page I declared all

2022-04-28 00:18:09    分类:问答    swift   xcode   markdown   swift-playground   xcplayground

Transition PageCurl to Scroll with UIPageViewController

I would like to change my animation between the view. Currently i have the PageCurl but i would like to have a Scroll animation like Snapchat. I can not use the var transitionStyle: UIPageViewControllerTransitionStyle { get } My ViewController : import UIKit class ViewController: UIPageViewController, UIPageViewControllerDataSource{ let pageViewController = UIPageViewController(transitionStyle: .Scroll, navigationOrientation: .Horizontal, options: nil) var messagesViewController : MessagesViewController! var searchViewController : SearchViewController! var friendsViewController

2022-04-27 03:28:40    分类:问答    ios   swift   xcode6   uipageviewcontroller   swift-playground

How to get a Canvas in a Swift Playground

问题 回答1 您可以使用类似的东西,注意您不必使用 Sprite Kit 类。 import UIKit import PlaygroundSupport import SpriteKit // Playground Container Setup // // let containerWidth: CGFloat = 667.0 let containerHeight: CGFloat = 375.0 let containerCenter: CGPoint = CGPoint(x: (containerWidth/2), y: (containerHeight/2)) let containerView = SKView(frame: CGRect(x: 0.0, y: 0.0, width: containerWidth, height: containerHeight)) PlaygroundPage.current.liveView = containerView let containterScene: SKScene = SKScene(size: CGSize(width: containerWidth, height: containerHeight)) containerView.presentScene(containterScene) 更新

2022-04-26 00:56:16    分类:技术分享    xcode   swift   swift-playground

Mouse events (NSTrackingArea) in Playground not working

问题 我有一个 NSView 的子类,其中包含以下 NSTrackingArea 代码。 但由于某种原因,鼠标事件不会在 Playground 中触发。 正在调用viewWillMoveToWindow ,但似乎没有其他任何事情发生。 有没有人知道丢失了什么? class MyView: NSView { private var trackingArea: NSTrackingArea = NSTrackingArea() // Other stuff omitted here... // ... override func viewWillMoveToWindow(newWindow: NSWindow?) { // Setup a new tracking area when the view is added to the window. trackingArea = NSTrackingArea(rect: self.bounds, options: [.MouseEnteredAndExited, .ActiveAlways], owner: self, userInfo: nil) self.addTrackingArea(trackingArea) } override func updateTrackingAreas() { self

2022-04-23 19:18:58    分类:技术分享    xcode   swift   swift-playground

Xcode 7 Playground execution EXC_BAD_ACCESS

问题 在 Xcode 7 Playgrounds 中运行最简单的默认代码...得到以下错误 Playground execution failed: Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x8). * thread #1: tid = 0x351bc3, 0x00000001062019ca libicucore.A.dylib`utext_clone + 22, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8) * frame #0: 0x00000001062019ca libicucore.A.dylib`utext_clone + 22 frame #1: 0x000000010633ac42 libicucore.A.dylib`icu::RegexMatcher::reset(UText*) + 54 frame #2: 0x0000000106375414 libicucore.A.dylib`uregex_setText + 222 frame #3: 0x0000000103d1b445 Foundation`-[NSRegularExpression

2022-04-21 15:54:04    分类:技术分享    swift-playground   xcode7