質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

Q&A

解決済

1回答

6274閲覧

[超初歩的質問] エラーメッセージ "Use of unresolved identifier"

UsagiPerry

総合スコア19

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

1グッド

1クリップ

投稿2017/05/23 14:57

編集2017/05/23 15:09

###前提・実現したいこと
swiftで以下のエラーが発生したので取り除きたいです。

###発生している問題・エラーメッセージ

Use of unresolved identifier 'labels'

###ViewController.swift

swift

1import UIKit 2import Anima 3import Charts 4import CoreGraphics 5 6class ViewController2: UIViewController { 7 8 override func viewDidLoad() { 9 super.viewDidLoad() 10 11 // Do any additional setup after loading the view. 12 } 13 14 override func didReceiveMemoryWarning() { 15 super.didReceiveMemoryWarning() 16 // Dispose of any resources that can be recreated. 17 } 18 19 20 private var animaView: Anima { 21 return animaView 22 } 23 24 @IBAction func ex3(_ sender: UIButton) { 25 26 let startAnimations: [AnimaType] = [.moveByY(-50), .rotateByZDegree(90)] 27 let moveAnimations: [AnimaType] = [.moveByX(50), .rotateByZDegree(90)] 28 let endAnimations: [AnimaType] = [.moveByY(-50), . 29 rotateByZDegree(90)] 30 31 func labelAnimaOption(index: Int) -> [AnimaOption] { 32 let labelAnima = labels[index]?.layer.anima 33 34 return [.completion({ 35 labelAnima?.then(.opacity(1)).fire() 36 })] 37 } 38 39 40 animaView.layer?.anima 41 .then(.opacity(1.0)) 42 .then(group: startAnimations) 43 .then(group: moveAnimations, options: labelAnimaOption(index: 0)) 44 .then(group: moveAnimations, options: labelAnimaOption(index: 1)) 45 .then(group: moveAnimations, options: labelAnimaOption(index: 2)) 46 .then(group: moveAnimations, options: labelAnimaOption(index: 3)) 47 .then(group: endAnimations, options: labelAnimaOption(index: 4)) 48 .then(group: [.scaleBy(0.0), AnimaType.opacity(0.0)]) 49 50 51 } 52 53} 54 55

Charts(ライブラリ)のRadarChartData.swift

swift

1// 2// RadarChartData.swift 3// Charts 4// 5// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6// A port of MPAndroidChart for iOS 7// Licensed under Apache License 2.0 8// 9// https://github.com/danielgindi/Charts 10// 11 12import Foundation 13import CoreGraphics 14 15 16open class RadarChartData: ChartData 17{ 18 open var highlightColor = NSUIColor(red: 255.0/255.0, green: 187.0/255.0, blue: 115.0/255.0, alpha: 1.0) 19 open var highlightLineWidth = CGFloat(1.0) 20 open var highlightLineDashPhase = CGFloat(0.0) 21 open var highlightLineDashLengths: [CGFloat]? 22 23 /// Sets labels that should be drawn around the RadarChart at the end of each web line. 24 open var labels = [String]() 25 26 /// Sets the labels that should be drawn around the RadarChart at the end of each web line. 27 open func setLabels(_ labels: String...) 28 { 29 self.labels = labels 30 } 31 32 public override init() 33 { 34 super.init() 35 } 36 37 public override init(dataSets: [IChartDataSet]?) 38 { 39 super.init(dataSets: dataSets) 40 } 41 42 open override func entryForHighlight(_ highlight: Highlight) -> ChartDataEntry? 43 { 44 return getDataSetByIndex(highlight.dataSetIndex)?.entryForIndex(Int(highlight.x)) 45 } 46}

###試したこと
'labels'で調べるとライブラリであるChartsのRaderChartDataで宣言されたものであった為、importしましたがエラー内容が変わりません。
RaderChartData.swiftのlabelsの宣言方法がopenだったのを変えたり、RaderChartData.swiftでimportしていたライブラリをViewController,swiftの方でimportしてみましたが同じエラーのままです。

どなたか知恵をいただけると幸いです

###補足情報(言語/FW/ツール等のバージョンなど)
より詳細な情報

DrqYuto👍を押しています

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

Viewcontrollerの方でlabelsを宣言し直したところ消えました。

投稿2017/05/23 17:49

UsagiPerry

総合スコア19

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問