Search results for

Swift 6

49,200 results found

Post

Replies

Boosts

Views

Activity

Swift Example Code
Just learning Swift and I noticed that Apple's example code on the Swift homepage does not compile in playground! I mean really, am I missing something?https://developer.apple.com/swift/extension String { var banana : String { let shortName = String(dropFirst(characters)) return (self) (self) Bo B(shortName) Banana Fana Fo F(shortName) } } let bananaName = Jimmy.bananaI changed line 03 to: { let shortName = String(dropFirst(self))This seems to work. I tried to find feedback and let them know, but there seems to be no place for developers to provide simple feedback.
4
0
830
Jun ’15
Reply to How does a view controller call functionality of a view (how is the link made?)
You have to create these connections in InterfaceBuilder. The following text gives a good explanation (examples in ObjectiveC but works in Swift the same):https://developer.apple.com/library/prerelease/ios/recipes/xcode_help-IB_connections/chapters/AboutConnectingObjectstoCode.htmlAnd no fear: Cocoa is a big framework and the needed information is sometimes a little hard to find 🙂
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’15
Reply to I want to put bordercolor with uiview by swift.
Thank you.I probably resolved this problem.'User Defined Runtime Attributes' was good clue for me.I tried the following code by referencing https://www.weheartswift.com/make-awesome-ui-components-ios-8-using-swift-xcode-6/@IBDesignableclass BorderView: UIView { @IBInspectable var cornerRadius: CGFloat = 5 { didSet { layer.cornerRadius = cornerRadius layer.masksToBounds = cornerRadius > 0 } } @IBInspectable var borderWidth: CGFloat = 1 { didSet { layer.borderWidth = borderWidth } } @IBInspectable var borderColor: UIColor? = UIColor.blueColor() { didSet { layer.borderColor = borderColor?.CGColor } }}if i tried above file on another project,it ran correctly.if i couldn't run correctly another project,i would write it.Thank you.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jun ’15
Missing Apple Watch Activity Data
I have just installed iOS 9 on my iPhone 6 Plus and when it started up it wiped my apple watch and I had to set it up again.After setting my apple watch up again I am missing the Activity Data for the last 48 hours, but when i look at the activity app on my phone the steps and what not are there but the rings for the last 2 days are both empty
5
0
1.8k
Jun ’15
Swift: Subclassing NSNotification
Hello everyone,Has anyone figured out a way to subclass NSNotification using Swift? I've done this in the past with Objective-C, but haven't figured out how to accomplish this with the rules for initializers in Swift. I realize there are alternatives to subclassing, but I'd really like to figure out how to do this. Here is a simplified version of what I'm attempting to do:class MyNotification: NSNotification { var someCustomData: String = override var name: String { return } override var object: AnyObject? { return nil } override var userInfo: [NSObject: AnyObject]? { return nil } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } init(someCustomData: String) { // Compiler wants me to call super.init, but this causes // issues since NSNotification is a class cluster. } }If I try calling super.init or using one of the NSNotification initializers when I instantiate an instance of MyNotification, I get this error:*** initialization method -initWithName:object:userInfo: ca
Topic: UI Frameworks SubTopic: AppKit Tags:
2
0
1.3k
Jun ’15
Reply to iOS 9 Beta battery life
Have you ever done a iOS beta before? These are very much to be expected.1. The claims they make will be what they are expecting for the final release2. iOS 6 beta was significantly worse.3. If you think this is bad... just wait, in the past the betas have gone from bad battery life to good, to bad again. They are working out the issues, you cannot expect this to work like a final product... because well, it is far from it.
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’15
iOS 9 Error 14
Have tried 5 or 6 times now it install the beta package for 1474 on two diffrent computers. Each time the install freezes after about 10% and itunes pops and error code 14. I have tried diffrent cables and ports with no luck so far. I have tried redownloading the package to insure it wasnt corrupted but still no luck. It restores to 8.3 from both computers without trouble. I am unsure what to do from here. Has anyone else come across this and resolved it? Any suggestions as to what to try next? Your help is appreciated.
8
0
812
Jun ’15
Reply to Metal Feature Sets ?
Apparently it is only supported on 6, 6+ and latest ipad (GPUFamily2) and adds on the features/limits of v1:http://f.cl.ly/items/2U341j1B1o1V0W3K253x/Bildschirmfoto%202015-06-10%20um%2000.48.20.pnghttp://f.cl.ly/items/0m421K2e3F2Q2y0g3k0Z/Bildschirmfoto%202015-06-10%20um%2000.58.33.pngAlso some new uniform buffer updating and a couple other things are new.
Topic: Graphics & Games SubTopic: General Tags:
Jun ’15
WCSession sendMessage returning errors (simulator)
I think I've got my Connectivity stuff set up properly, was going off the Lister sample app. But, every time I try to send stuff via WCSession, it fails. Here's the code:// iOS App, in my ViewController override func viewDidLoad() { super.viewDidLoad() if WCSession.isSupported() { WCSession.defaultSession().delegate = self WCSession.defaultSession().activateSession() } } func session(session: WCSession, didReceiveMessage message: [String : AnyObject]) { let msg = message[message] as! String print(Got message! (msg)) } // -------------- // WatchKit Extension - WKInterfaceController subclass @IBAction func buttonTapped() { let session = WCSession.defaultSession() print(Session is reachable: (session.reachable)) // this is false let msg = [message: derp derp derp] session.sendMessage(msg, replyHandler: { reply in print(Got reply: (reply)) }, errorHandler: { error in print(error: (error)) }) }The error in the errorHandler reads Error Domain=WCErrorDomain Code=7004 The operation couldn’t be completed. (WCErrorDoma
6
0
6.9k
Jun ’15
SKDefaultShading with Metal-based SceneKit
On iOS 8, this code (Swift) worked:let shaderString = void main() + { + gl_FragColor = SKDefaultShading().bgra; + } let shader = SKShader(source: shaderString)Now on iOS 9, with Metal under the covers, I get this error message:2015-06-09 18:36:39.497 TestVideoCam[550:63920] Jet: Error Domain=MTLLibraryErrorDomain Code=3 Compilation failed: program_source:6:321: error: use of undeclared identifier 'SKDefaultShading' fragment float4 SKShader_FragFunc( texture2d<float> u_texture [[texture(0)]], const device float *u_time [[buffer(0)]], const device float2 *u_sprite_size [[buffer(1)]], const device float *u_path_length [[buffer(2)]], SKShader_VertexOut interpolated [[stage_in]]){return SKDefaultShading().bgra;} ^ UserInfo=0x156e50c10 {NSLocalizedDescription=Compilation failed: program_source:6:321: error: use of undeclared identifier 'SKDefaultShading' fragment float4 SKShader_FragFunc( texture2d<float> u_texture [[texture(0)]], const device float *u_time [[buffer(0)]], con
13
0
3.9k
Jun ’15
Xcode 7 Doesn't See My Framework
Updated an app to iOS 9 / Swift 2 / watchOS 2 and since then, Xcode claims it can't find my embedded framework when building the watchOS extension. It has no issues finding it for my iOS app and the build settings look ok - the framework is showing as a dependency... but yeah, no dice. Tried cleaning and nuking Derived Data.Any ideas?
3
0
2.6k
Jun ’15